test for endpoints
@@ -5,7 +5,6 @@ from HARK.distribution import (
Bernoulli,
DiscreteDistribution,
DiscreteDistributionXRA,
- expected,
IndexDistribution,
Lognormal,
MarkovProcess,
@@ -19,6 +18,7 @@ from HARK.distribution import (
calc_normal_style_pars_from_lognormal_pars,
combine_indep_dstns,
distr_of_function,
+ expected,
)
@@ -333,6 +333,12 @@ class DistributionClassTests(unittest.TestCase):
self.assertEqual(calc_expectation(uni.approx(10)), 0.5)
+ uni_discrete = uni.approx(10, endpoint=True)
+
+ self.assertEqual(uni_discrete.atoms[0][0], 0.0)
+ self.assertEqual(uni_discrete.atoms[0][-1], 1.0)
+ self.assertEqual(calc_expectation(uni.approx(10)), 0.5)
+
def test_Bernoulli(self):
Bernoulli().draw(1)[0]
