示例#1
0
def test_mixer_smoke():
    ss = SeedSequence(np.arange(100, dtype=np.uint32))
    assert_array_equal(ss.entropy, np.arange(100, dtype=np.uint32))
示例#2
0
def test_uint_scalar_entropy():
    ss0 = SeedSequence(0)
    ss1 = SeedSequence(np.uint32(0))
    assert_array_equal(ss0.generate_state(4), ss1.generate_state(4))
示例#3
0
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"])
示例#4
0
def test_min_pool_size():
    with pytest.raises(ValueError, match="The size of the entropy"):
        SeedSequence(pool_size=3)
示例#5
0
def test_invalid_dtype_gen_state():
    ss = SeedSequence(0)
    with pytest.raises(ValueError):
        ss.generate_state(4, dtype=np.uint8)
示例#6
0
def test_bad_spawn_key():
    with pytest.raises(TypeError, match="seed must be integer"):
        SeedSequence(spawn_key=(np.pi, ))
示例#7
0
def test_against_numpy():
    ss = SeedSequence(0)
    np_ss = NPSeedSequence(0)
    assert_array_equal(ss.generate_state(10), np_ss.generate_state(10))