def test_offgrid_float(self): qn = qnormal_gen(0, 1, .2) assert qn.pmf(0) > 0.0 assert qn.pmf(.1) == 0.0 assert qn.pmf(.2) > 0.0 assert qn.pmf(.4) > 0.0 assert qn.pmf(-.2) > 0.0 assert qn.pmf(-.4) > 0.0 assert qn.pmf(.99) == 0.0 assert qn.pmf(-.99) == 0.0
def test_offgrid_float(self): qn = qnormal_gen(0, 1, 0.2) assert qn.pmf(0) > 0.0 assert qn.pmf(0.1) == 0.0 assert qn.pmf(0.2) > 0.0 assert qn.pmf(0.4) > 0.0 assert qn.pmf(-0.2) > 0.0 assert qn.pmf(-0.4) > 0.0 assert qn.pmf(0.99) == 0.0 assert qn.pmf(-0.99) == 0.0
def test_rvs(self): for mu, sigma, q in [(0, 1, .1), (-20, 3, 3),]: qn = qnormal_gen(mu, sigma, q) #tdb.check_ppf_ppf(qn, ()) #tdb.check_cdf_ppf(qn, (), '') try: check_d_samples(qn, n=10000) except: print mu, sigma, q raise
def test_numeric(self): qn = qnormal_gen(0, 1, 1) assert qn.pmf(500) > -np.inf
def test_offgrid_int(self): qn = qnormal_gen(0, 1, 2) assert qn.pmf(0) > 0.0 assert qn.pmf(1) == 0.0 assert qn.pmf(2) > 0.0
def test_bigq(self): mu, sigma, q = (-20, 4, 3) qn = qnormal_gen(mu, sigma, q) check_d_samples(qn, n=10000)
def test_smallq(self): mu, sigma, q = (0, 1, .1) qn = qnormal_gen(mu, sigma, q) check_d_samples(qn, n=10000)
def test_output_type_float(self): assert float == type(qnormal_gen(0, 10, 1.0).rvs())
def test_output_type_int(self): result = qnormal_gen(0, 10, 1).rvs() assert int == type(result)