MCPcopy
hub / github.com/numpy/numpy / test_seedsequence

Function test_seedsequence

numpy/random/tests/test_direct.py:143–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141
142
143def test_seedsequence():
144 from numpy.random.bit_generator import (
145 ISeedSequence,
146 ISpawnableSeedSequence,
147 SeedlessSeedSequence,
148 )
149
150 s1 = SeedSequence(range(10), spawn_key=(1, 2), pool_size=6)
151 s1.spawn(10)
152 s2 = SeedSequence(**s1.state)
153 assert_equal(s1.state, s2.state)
154 assert_equal(s1.n_children_spawned, s2.n_children_spawned)
155
156 # The interfaces cannot be instantiated themselves.
157 assert_raises(TypeError, ISeedSequence)
158 assert_raises(TypeError, ISpawnableSeedSequence)
159 dummy = SeedlessSeedSequence()
160 assert_raises(NotImplementedError, dummy.generate_state, 10)
161 assert len(dummy.spawn(10)) == 10
162
163
164def test_generator_spawning():

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…