def test_mix_d6_faces(): assert Die.mix(1, 2, 3, 4, 5, 6).pmf() == pytest.approx(Die.d6.pmf())
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())
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)
def test_mix_identical(): assert Die.mix(Die.d6, Die.d6, Die.d6, Die.d6).pmf() == pytest.approx(Die.d6.pmf())