diff options
Diffstat (limited to 'numpy/random/tests/test_generator_mt19937.py')
-rw-r--r-- | numpy/random/tests/test_generator_mt19937.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/random/tests/test_generator_mt19937.py b/numpy/random/tests/test_generator_mt19937.py index fa55ac0ee..0f4437bcb 100644 --- a/numpy/random/tests/test_generator_mt19937.py +++ b/numpy/random/tests/test_generator_mt19937.py @@ -2695,3 +2695,16 @@ def test_contig_req_out(dist, order, dtype): assert variates is out variates = dist(out=out, dtype=dtype, size=out.shape) assert variates is out + + +def test_generator_ctor_old_style_pickle(): + rg = np.random.Generator(np.random.PCG64DXSM(0)) + rg.standard_normal(1) + # Directly call reduce which is used in pickline + ctor, args, state_a = rg.__reduce__() + # Simulate unpickling an old pickle that only has the name + assert args[:1] == ("PCG64DXSM",) + b = ctor(*args[:1]) + b.bit_generator.state = state_a + state_b = b.bit_generator.state + assert state_a == state_b |