예제 #1
0
 def test_near_zero(self):
     eps = sys.float_info.epsilon
     equal = [(0, 0), (eps, 0), (0, -eps), (-eps, eps)]
     for a, b in equal:
         self.assertAlmostEqual(a, b)
         self.assertTrue(msprime.almost_equal(a, b, abs_tol=1e-9))
     not_equal = [(0, 0.0000001), (-0.0000001, 0)]
     for a, b in not_equal:
         self.assertNotAlmostEqual(a, b)
         self.assertFalse(msprime.almost_equal(a, b, abs_tol=1e-9))
예제 #2
0
 def test_near_zero(self):
     eps = sys.float_info.epsilon
     equal = [(0, 0), (eps, 0), (0, -eps), (-eps, eps)]
     for a, b in equal:
         self.assertAlmostEqual(a, b)
         self.assertTrue(
             msprime.almost_equal(a, b, abs_tol=1e-9))
     not_equal = [(0, 0.0000001), (-0.0000001, 0)]
     for a, b in not_equal:
         self.assertNotAlmostEqual(a, b)
         self.assertFalse(
             msprime.almost_equal(a, b, abs_tol=1e-9))
예제 #3
0
 def test_defaults(self):
     eps = sys.float_info.epsilon
     equal = [(1, 1), (0, 0), (1 + eps, 1), (1, 1 - eps),
              (10.000000000001, 10.0)]
     for a, b in equal:
         self.assertAlmostEqual(a, b)
         self.assertTrue(msprime.almost_equal(a, b))
예제 #4
0
 def test_defaults(self):
     eps = sys.float_info.epsilon
     equal = [
         (1, 1), (0, 0), (1 + eps, 1), (1, 1 - eps),
         (10.000000000001, 10.0)]
     for a, b in equal:
         self.assertAlmostEqual(a, b)
         self.assertTrue(msprime.almost_equal(a, b))