def test_interpolate_big_not_raises(self): arr = [0.02, 0.028, -0.069, -0.067, -0.019, -0.051, 0.028, -0.038, 0.03, 0.042, 0.063, 0.013, 0.026, 0.066, 0.105, 0.173, 0.184, 0.223, 0.241, 0.259, 0.313, 0.369, 0.435, 0.394, 0.454, 0.458, 0.465, 0.438, 0.442, 0.454, 0.465, 0.466, 0.501, 0.396, 0.372, 0.414, 0.506, 0.508, 0.349, 0.339, 0.392, 0.38, 0.387, 0.223, 0.203, 0.214, 0.13, 0.096, 0.105, 0.074, 0.024, 0.022, 0.074] prepaire.interpolate_array(arr, 100)
def test_interpolate_big_not_raises(self): arr = [ 0.02, 0.028, -0.069, -0.067, -0.019, -0.051, 0.028, -0.038, 0.03, 0.042, 0.063, 0.013, 0.026, 0.066, 0.105, 0.173, 0.184, 0.223, 0.241, 0.259, 0.313, 0.369, 0.435, 0.394, 0.454, 0.458, 0.465, 0.438, 0.442, 0.454, 0.465, 0.466, 0.501, 0.396, 0.372, 0.414, 0.506, 0.508, 0.349, 0.339, 0.392, 0.38, 0.387, 0.223, 0.203, 0.214, 0.13, 0.096, 0.105, 0.074, 0.024, 0.022, 0.074 ] prepaire.interpolate_array(arr, 100)
def test_interpolate_empty_array(self): arr = [] result = prepaire.interpolate_array(arr, 3) etalon_array = [0, 0, 0] for i in xrange(len(etalon_array)): self.assertAlmostEqual(etalon_array[i], result[i])
def test_interpolate_less_two(self): arr = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] result = prepaire.interpolate_array(arr, 3) etalon_array = [-5, 0, 5] for i in xrange(len(etalon_array)): self.assertAlmostEqual(etalon_array[i], result[i])
def test_interpolate_mixed(self): arr = [1, -1, 1] result = prepaire.interpolate_array(arr, 5) etalon_array = [1, 0, -1, 0, 1] for i in xrange(len(etalon_array)): self.assertAlmostEqual(etalon_array[i], result[i])
def test_interpolate_less(self): arr = [3, 6, 9, 12, 15] result = prepaire.interpolate_array(arr, 3) etalon_array = [3, 9, 15] for i in xrange(len(etalon_array)): self.assertAlmostEqual(etalon_array[i], result[i])
def test_interpolate_more(self): arr = [2, 3, 4, 5, 6] result = prepaire.interpolate_array(arr, 5) etalon_array = [2, 3, 4, 5, 6] for i in xrange(len(etalon_array)): self.assertAlmostEqual(etalon_array[i], result[i])