def test_sample1(): # Basic sample d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d) assert x == '101' # with log dist dit.math.prng.seed(0) d.set_base(3.5) x = module.sample(d) assert x == '101'
def test_sample1(): # Basic sample d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d) assert_equal(x, '101') # with log dist dit.math.prng.seed(0) d.set_base(3.5) x = module.sample(d) assert_equal(x, '101')
def test_sample6(): # Not enough rands d = dit.example_dists.Xor() with pytest.raises(ditException): module.sample(d, 5, rand=[.1] * 3)
def test_sample5(): # Bad prng d = dit.example_dists.Xor() with pytest.raises(ditException): module.sample(d, prng=3)
def test_sample4(): # More than one random number d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d, 6) assert x == ['101', '101', '101', '101', '011', '101']
def test_sample3(): # Specified rand number d = dit.example_dists.Xor() x = module.sample(d, rand=.3) assert x == '011'
def test_sample2(): # Specified prng d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d, prng=dit.math.prng) assert x == '101'
def test_sample4(): # More than one random number d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d, 6) assert_equal(x, ['101', '101', '101', '101', '011', '101'])
def test_sample3(): # Specified rand number d = dit.example_dists.Xor() x = module.sample(d, rand=.3) assert_equal(x, '011')
def test_sample2(): # Specified prng d = dit.example_dists.Xor() dit.math.prng.seed(0) x = module.sample(d, prng=dit.math.prng) assert_equal(x, '101')