예제 #1
0
def test_to_string10():
    # Basic
    d = ScalarDistribution([], sample_space=[0, 1], validate=False)
    s = d.to_string()
    s_ = """Class:    ScalarDistribution
Alphabet: (0, 1)
Base:     2

x   log p(x)"""
    assert_equal(s, s_)
예제 #2
0
def test_to_string10():
    # Basic
    d = ScalarDistribution([], sample_space=[0, 1], validate=False)
    s = d.to_string()
    s_ = """Class:    ScalarDistribution
Alphabet: (0, 1)
Base:     2

x   log p(x)"""
    assert s == s_
예제 #3
0
def test_to_string7():
    # Basic
    outcomes = ['00', '01', '10', '11']
    pmf = [1/4]*4
    d = ScalarDistribution(outcomes, pmf)
    s = d.to_string()
    s_ = """Class:    ScalarDistribution
Alphabet: ('00', '01', '10', '11')
Base:     linear

x    p(x)
00   0.25
01   0.25
10   0.25
11   0.25"""
    assert_equal(s, s_)
예제 #4
0
def test_to_string7():
    # Basic
    outcomes = ['00', '01', '10', '11']
    pmf = [1/4]*4
    d = ScalarDistribution(outcomes, pmf)
    s = d.to_string()
    s_ = """Class:    ScalarDistribution
Alphabet: ('00', '01', '10', '11')
Base:     linear

x    p(x)
00   0.25
01   0.25
10   0.25
11   0.25"""
    assert s == s_