Esempio n. 1
0
    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())
Esempio n. 2
0
    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,))
Esempio n. 3
0
    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())
Esempio n. 4
0
    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,))
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)