Esempio n. 1
0
def test_mix_d6_faces():
    assert Die.mix(1, 2, 3, 4, 5, 6).pmf() == pytest.approx(Die.d6.pmf())
Esempio n. 2
0
def test_mix_weight():
    outcomes = range(2, 13)
    mix_weights = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]
    assert Die.mix(*outcomes, mix_weights=mix_weights).pmf() == pytest.approx(
        Die.d(2, 6).pmf())
Esempio n. 3
0
def test_mix_mixed():
    die = Die.mix(Die.d4, Die.d6, mix_weights=Die.coin())
    assert die.pmf() == pytest.approx([5 / 24] * 4 + [2 / 24] * 2)
Esempio n. 4
0
def test_mix_identical():
    assert Die.mix(Die.d6, Die.d6, Die.d6,
                   Die.d6).pmf() == pytest.approx(Die.d6.pmf())