MCPcopy Index your code
hub / github.com/numpy/numpy / test_legacy_pickle

Function test_legacy_pickle

numpy/random/tests/test_generator_mt19937.py:2814–2830  ·  view source on GitHub ↗
(version)

Source from the content-addressed store, hash-verified

2812
2813@pytest.mark.parametrize("version", [121, 126])
2814def test_legacy_pickle(version):
2815 # Pickling format was changes in 1.22.x and in 2.0.x
2816 import gzip
2817 import pickle
2818
2819 base_path = os.path.split(os.path.abspath(__file__))[0]
2820 pkl_file = os.path.join(
2821 base_path, "data", f"generator_pcg64_np{version}.pkl.gz"
2822 )
2823 with gzip.open(pkl_file) as gz:
2824 rg = pickle.load(gz)
2825 state = rg.bit_generator.state['state']
2826
2827 assert isinstance(rg, Generator)
2828 assert isinstance(rg.bit_generator, np.random.PCG64)
2829 assert state['state'] == 35399562948360463058890781895381311971
2830 assert state['inc'] == 87136372517582989555478159403783844777

Callers

nothing calls this directly

Calls 4

splitMethod · 0.80
joinMethod · 0.80
abspathMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…