def test_del3(): d = ScalarDistribution([1 / 2, 1 / 2]) with pytest.raises(InvalidOutcome): d.__delitem__(2)
def test_setitem2(): pmf = [1 / 2, 1 / 2] d = ScalarDistribution(pmf) with pytest.raises(InvalidOutcome): d.__setitem__(2, 1 / 2)
def test_del2(): d = ScalarDistribution([1 / 2, 1 / 2]) d.make_dense() del d[1] d.normalize() assert d[0] == pytest.approx(1)