working on implementing the cubic interpolation. need to split that routine out of the run_baker method
This commit is contained in:
+9
-8
@@ -23,6 +23,7 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
]
|
||||
self.q = [1, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
self.X = [1.5, 10.25]
|
||||
self.accuracy = 8
|
||||
|
||||
def testImports(self):
|
||||
import numpy
|
||||
@@ -36,9 +37,9 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
r = [[-1, -1], [0, 2], [1, -1]]
|
||||
|
||||
result = baker.get_phis(X, r)
|
||||
result = [round(i, 5) for i in result]
|
||||
result = [round(i, self.accuracy) for i in result]
|
||||
|
||||
right_answer = [round(i, 5) for i in [1/3.0, 1/3.0, 1/3.0]]
|
||||
right_answer = [round(i, self.accuracy) for i in [1/3.0, 1/3.0, 1/3.0]]
|
||||
|
||||
for a,b in zip(result, right_answer):
|
||||
self.assertEqual(a,b)
|
||||
@@ -77,13 +78,13 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
self.q[size_of_simplex:size_of_simplex + extra_points])
|
||||
|
||||
answer = baker.run_baker(self.X, R, S)
|
||||
a = round(answer['a'], 5)
|
||||
b = round(answer['b'], 5)
|
||||
c = round(answer['c'], 5)
|
||||
a = round(answer['a'], self.accuracy)
|
||||
b = round(answer['b'], self.accuracy)
|
||||
c = round(answer['c'], self.accuracy)
|
||||
|
||||
self.assertEqual(a, c)
|
||||
self.assertEqual(c, round(0.00 , 5))
|
||||
self.assertEqual(b, round(1/3.0, 5))
|
||||
self.assertEqual(c, round(0.00 , self.accuracy))
|
||||
self.assertEqual(b, round(1/3.0, self.accuracy))
|
||||
|
||||
def testRunBaker_2(self):
|
||||
size_of_simplex = 3
|
||||
@@ -144,4 +145,4 @@ class TestSequenceFunctions(unittest.TestCase):
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
|
||||
unittest.TextTestRunner(verbosity=2).run(suite)
|
||||
unittest.TextTestRunner(verbosity=3).run(suite)
|
||||
|
||||
Reference in New Issue
Block a user