Exemplo n.º 1
0
 def test_interpolate_different_paths(self):
     current = [1, 1, 1]
     needed = [2, 5, 4]
     for i in range(26):  # Loop until needed is reached and a bit further
         current = interpolate(current, needed, 1, 0.2)
     self.assertEqual(current, [2, 5, 4])
Exemplo n.º 2
0
 def test_interpolate_empty_lists(self):
     current = []
     needed = []
     result = interpolate(current, needed, 1, 0.1)
     self.assertEqual(result, [])
Exemplo n.º 3
0
 def test_negative_value_error(self):
     current = [2, 5, 6]
     needed = [4, 3, 4]
     with self.assertRaises(NegativeValueError):
         interpolate(current, needed, -1, 0.1)
Exemplo n.º 4
0
 def test_interpolate_list_length(self):
     current = [2, 5, 6, 8]
     needed = [4, 3, 4]
     with self.assertRaises(UnequalLengthError):
         interpolate(current, needed, 1, 0.1)
Exemplo n.º 5
0
 def test_interpolate_up_and_down(self):
     current = [2, 5, 6]
     needed = [4, 3, 4]
     result = interpolate(current, needed, 3, 0.1)
     self.assertEqual(result, [2.3, 4.7, 5.7])
Exemplo n.º 6
0
 def test_interpolate_down(self):
     current = [5, 5, 5]
     needed = [3, 3, 3]
     result = interpolate(current, needed, 1, 0.1)
     self.assertEqual(result, [4.9, 4.9, 4.9])
Exemplo n.º 7
0
 def test_interpolate_up(self):
     current = [0, 0, 0]
     needed = [1, 1, 1]
     result = interpolate(current, needed, 1, 0.1)
     self.assertEqual(result, [0.1, 0.1, 0.1])