def test_mixer_smoke(): ss = SeedSequence(np.arange(100, dtype=np.uint32)) assert_array_equal(ss.entropy, np.arange(100, dtype=np.uint32))
def test_uint_scalar_entropy(): ss0 = SeedSequence(0) ss1 = SeedSequence(np.uint32(0)) assert_array_equal(ss0.generate_state(4), ss1.generate_state(4))
def test_bad_entropy(): with pytest.raises((TypeError, ), match="SeedSequence expects int"): SeedSequence(entropy=SeedSequence()) with pytest.raises(ValueError, match="unrecognized seed string"): SeedSequence(entropy=["apple"])
def test_min_pool_size(): with pytest.raises(ValueError, match="The size of the entropy"): SeedSequence(pool_size=3)
def test_invalid_dtype_gen_state(): ss = SeedSequence(0) with pytest.raises(ValueError): ss.generate_state(4, dtype=np.uint8)
def test_bad_spawn_key(): with pytest.raises(TypeError, match="seed must be integer"): SeedSequence(spawn_key=(np.pi, ))
def test_against_numpy(): ss = SeedSequence(0) np_ss = NPSeedSequence(0) assert_array_equal(ss.generate_state(10), np_ss.generate_state(10))