MCPcopy Create free account
hub / github.com/numpy/numpy / test_seedsequence

Function test_seedsequence

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

Source from the content-addressed store, hash-verified

130
131
132def test_seedsequence():
133 from numpy.random.bit_generator import (ISeedSequence,
134 ISpawnableSeedSequence,
135 SeedlessSeedSequence)
136
137 s1 = SeedSequence(range(10), spawn_key=(1, 2), pool_size=6)
138 s1.spawn(10)
139 s2 = SeedSequence(**s1.state)
140 assert_equal(s1.state, s2.state)
141 assert_equal(s1.n_children_spawned, s2.n_children_spawned)
142
143 # The interfaces cannot be instantiated themselves.
144 assert_raises(TypeError, ISeedSequence)
145 assert_raises(TypeError, ISpawnableSeedSequence)
146 dummy = SeedlessSeedSequence()
147 assert_raises(NotImplementedError, dummy.generate_state, 10)
148 assert len(dummy.spawn(10)) == 10
149
150
151def test_generator_spawning():

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected