@@ -0,0 +1,1792 @@
+from __future__ import division%0A%0Afrom nose.tools import assert_almost_equal, assert_in, assert_raises, %5C%0A                       assert_true%0A%0Afrom dit import Distribution%0Afrom dit.distribution import BaseDistribution%0Afrom dit.exceptions import ditException, InvalidNormalization%0A%0Adef test_dist_iter1():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    for o in d:%0A        assert_in(o, outcomes)%0A%0A%0Adef test_dist_iter2():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    for o in reversed(d):%0A        assert_in(o, outcomes)%0A%0A%0Adef test_numerical():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    assert_true(d.is_numerical())%0A%0A%0Adef test_rand():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    for _ in range(10):%0A        assert_in(d.rand(), outcomes)%0A%0A%0Adef test_to_dict():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    dd = d.to_dict()%0A    for o, p in dd.items():%0A        assert_almost_equal(d%5Bo%5D, p)%0A%0Adef test_validate1():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    assert_true(d.validate())%0A    assert_true(BaseDistribution.validate(d))%0A%0Adef test_validate2():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    d%5B'00'%5D = 0%0A    assert_raises(InvalidNormalization, d.validate)%0A    assert_raises(InvalidNormalization, BaseDistribution.validate, d)%0A%0Adef test_zipped1():%0A    outcomes = %5B'00', '01', '10', '11'%5D%0A    pmf = %5B1/4%5D*4%0A    d = Distribution(outcomes, pmf)%0A    zipped = d.zipped(mode='pants')%0A    assert_raises(ditException, list, zipped)

add tests for distribution