def test_2(self): tau = 1. time = np.array([-0.01, 0.26, 0.51, 0.76, 1.01, 1.26, 1.51]) tri_exp = np.array([0.5, 0.74, 0.49, 0.24, 0., 0., 0.]) tri_act = triangle(time, tau) tri_exp = np.around(tri_exp, 12) tri_act = np.around(tri_act, 12) self.assertSequenceEqual(tri_exp.tolist(), tri_act.tolist(), msg="In TestTriangle test 2: triangle arrays differ")
def test_1(self): tau = 1. time = np.array([-0.5, -0.25, 0., 0.25, 0.5, 0.75, 1, 1.25, 1.5]) tri_exp = np.array([0., 0., 0.5, 0.75, 0.5, 0.25, 0., 0., 0.]) tri_act = triangle(time, tau) tri_exp = np.around(tri_exp, 12) tri_act = np.around(tri_act, 12) self.assertSequenceEqual(tri_exp.tolist(), tri_act.tolist(), msg="In TestTriangle test 1: triangle arrays differ")