if order doesn't matter, the test for baker stuff is back online
This commit is contained in:
parent
53d555914e
commit
ba848f6924
@ -38,7 +38,6 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
r = [[-1, -1], [0, 2], [1, -1]]
|
||||
|
||||
result = baker.get_phis(X, r)
|
||||
#result = [round(i, self.accuracy) for i in result]
|
||||
|
||||
right_answer = [1/3.0, 1/3.0, 1/3.0]
|
||||
|
||||
@ -78,15 +77,14 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
S = grid.grid(self.all_points[size_of_simplex:size_of_simplex + extra_points],
|
||||
self.q[size_of_simplex:size_of_simplex + extra_points])
|
||||
|
||||
|
||||
answer = baker.run_baker(self.X, R, S)
|
||||
print "\n", answer['abc']
|
||||
|
||||
a = answer['abc'][0]
|
||||
b = answer['abc'][1]
|
||||
c = answer['abc'][2]
|
||||
|
||||
self.assertAlmostEqual(a, c)
|
||||
self.assertAlmostEqual(c, 0.0)
|
||||
self.assertAlmostEqual(b, 1/3.0)
|
||||
self.assertEqual(sorted((a,b,c)), sorted((0,0.0,1/3.)))
|
||||
|
||||
def testRunBaker_2(self):
|
||||
size_of_simplex = 3
|
||||
@ -100,12 +98,11 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
|
||||
answer = baker.run_baker(self.X, R, S)
|
||||
|
||||
a = answer['a']
|
||||
b = answer['b']
|
||||
c = answer['c']
|
||||
a = answer['abc'][0]
|
||||
b = answer['abc'][1]
|
||||
c = answer['abc'][2]
|
||||
|
||||
self.assertAlmostEqual(a, c)
|
||||
self.assertAlmostEqual(c, 2/3.0)
|
||||
self.assertEqual(sorted((a,b,c)), sorted((2/3.0, 2/3.0, 1/3.0)))
|
||||
|
||||
def testRunBaker_3(self):
|
||||
size_of_simplex = 3
|
||||
@ -118,13 +115,17 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
self.q[size_of_simplex:size_of_simplex + extra_points])
|
||||
|
||||
answer = baker.run_baker(self.X, R, S)
|
||||
a = answer['a']
|
||||
b = answer['b']
|
||||
c = answer['c']
|
||||
|
||||
self.assertAlmostEqual(a, 13/14.0)
|
||||
self.assertAlmostEqual(b, 2 / 7.0)
|
||||
self.assertAlmostEqual(c, 15/14.0)
|
||||
a = answer['abc'][0]
|
||||
b = answer['abc'][1]
|
||||
c = answer['abc'][2]
|
||||
|
||||
a,b,c = sorted((a,b,c))
|
||||
aa, bb, cc = sorted((13/14., 2/7., 15/14.))
|
||||
|
||||
self.assertAlmostEqual(a,aa)
|
||||
self.assertAlmostEqual(b,bb)
|
||||
self.assertAlmostEqual(c,cc)
|
||||
|
||||
def testRunBaker_4(self):
|
||||
size_of_simplex = 3
|
||||
@ -137,13 +138,16 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
self.q[size_of_simplex:size_of_simplex + extra_points])
|
||||
|
||||
answer = baker.run_baker(self.X, R, S)
|
||||
a = answer['a']
|
||||
b = answer['b']
|
||||
c = answer['c']
|
||||
a = answer['abc'][0]
|
||||
b = answer['abc'][1]
|
||||
c = answer['abc'][2]
|
||||
|
||||
self.assertAlmostEqual(a, 48/53.0)
|
||||
self.assertAlmostEqual(b, 15/53.0)
|
||||
self.assertAlmostEqual(c, 54/53.0)
|
||||
a,b,c = sorted((a,b,c))
|
||||
aa,bb,cc = sorted((48/53.0, 15/53.0, 54/53.0))
|
||||
|
||||
self.assertAlmostEqual(a, aa)
|
||||
self.assertAlmostEqual(b, bb)
|
||||
self.assertAlmostEqual(c, cc)
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
|
||||
|
Loading…
Reference in New Issue
Block a user