def test_return_values(self): out = draw(self.cdf) assert_(out in range(self.n)) size = 10 out = draw(self.cdf, size) assert_(np.isin(out, range(self.n)).all())
def test_return_types(self): out = draw(self.cdf) assert_(isinstance(out, numbers.Integral)) size = 10 out = draw(self.cdf, size) assert_(out.shape == (size,))
def test_return_values(self): out = draw(self.cdf) ok_(out in range(self.n)) size = 10 out = draw(self.cdf, size) ok_(np.isin(out, range(self.n)).all())
def test_return_types(self): out = draw(self.cdf) ok_(isinstance(out, numbers.Integral)) size = 10 out = draw(self.cdf, size) eq_(out.shape, (size,))
def test_lln(self): size = 1000000 out = draw(self.cdf, size) hist, bin_edges = np.histogram(out, bins=self.n, density=True) pmf_computed = hist * np.diff(bin_edges) atol = 1e-2 assert_allclose(pmf_computed, self.pmf, atol=atol)