Commit 810ba652 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

[Tests][Python] clean formatting

parent b8c5d3e5
......@@ -18,10 +18,10 @@ class ConstantCurveTest(unittest.TestCase):
self.assertEqual(c.degree(), 0)
# constructor from a point
p = array([1, 23. ,5., 9, -5])
p = array([1, 23., 5., 9, -5])
c = constant(p)
self.assertEqual(c.min(), 0.)
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertEqual(c.dim(), 5)
self.assertEqual(c.degree(), 0)
......@@ -77,8 +77,8 @@ class ConstantCurveTest(unittest.TestCase):
c2 = constant(p, 1., 3.)
c3 = c1
pn = array([1,23., 5., 9])
p2 = array([1,17., 5., 9, -5])
pn = array([1, 23., 5., 9])
p2 = array([1, 17., 5., 9, -5])
cn1 = constant(pn, 1., 3.)
cn2 = constant(p, 1.5, 3.)
cn3 = constant(p, 1., 2.)
......@@ -126,7 +126,7 @@ class Constant3CurveTest(unittest.TestCase):
p = array([1, 23., 5.])
c = constant3(p)
self.assertEqual(c.min(), 0.)
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertEqual(c.dim(), 3)
self.assertEqual(c.degree(), 0)
......
......@@ -11,7 +11,7 @@ from numpy import array, isclose, array_equal
class MinJerkCurveTest(unittest.TestCase):
def test_constructors(self):
# constructor from two points
init = array([1, 23. ,5., 9, -5])
init = array([1, 23., 5., 9, -5])
end = array([1.2, -5.1, 5.6, 1, -2])
c = polynomial.MinimumJerk(init, end)
self.assertEqual(c.min(), 0.)
......@@ -21,7 +21,6 @@ class MinJerkCurveTest(unittest.TestCase):
self.assertTrue(isclose(c(0.), init).all())
self.assertTrue(isclose(c(1.), end).all())
# constructor with timing
c = polynomial.MinimumJerk(init, end, 2., 6.)
self.assertEqual(c.min(), 2.)
......@@ -38,7 +37,7 @@ class MinJerkCurveTest(unittest.TestCase):
polynomial.MinimumJerk(init, end, 2., 0.)
def test_derivate(self):
init = array([1, 23. ,5., 9, -5])
init = array([1, 23., 5., 9, -5])
end = array([1.2, -5.1, 5.6, 1, -2])
p0 = np.zeros(5)
c = polynomial.MinimumJerk(init, end, 2., 6.)
......@@ -49,5 +48,6 @@ class MinJerkCurveTest(unittest.TestCase):
self.assertTrue(isclose(c.derivate(6., 2), p0).all())
self.assertTrue(isclose(c.derivate(3., 6), p0).all())
if __name__ == '__main__':
unittest.main()
......@@ -25,7 +25,7 @@ class SinusoidalCurveTest(unittest.TestCase):
c = sinusoidal(p0, amp, T, phi)
self.assertEqual(c.min(), 0.)
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertEqual(c.dim(), 3)
self.assertEqual(c.degree(), 1)
......@@ -41,17 +41,16 @@ class SinusoidalCurveTest(unittest.TestCase):
p_end = array([-1.2, -3, 2.7, -3.2])
c = sinusoidal(1.5, p_init, p_end)
self.assertEqual(c.min(), 0.)
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertTrue(c.max() > 1e100) # convert std::numeric_limits<time_t>::max() to python ?
self.assertEqual(c.dim(), 4)
self.assertEqual(c.degree(), 1)
# constructor from stationary points with timing
p_init = array([1.2, -5, 3.6, 5.])
p_end = array([-1.2, -3, 2.7, -3.2])
c = sinusoidal(1.5, p_init, p_end, 1.5, 25)
self.assertEqual(c.min(), 1.5)
self.assertEqual(c.max(), 25.) # convert std::numeric_limits<time_t>::max() to python ?
self.assertEqual(c.max(), 25.) # convert std::numeric_limits<time_t>::max() to python ?
self.assertEqual(c.dim(), 4)
self.assertEqual(c.degree(), 1)
......@@ -65,7 +64,6 @@ class SinusoidalCurveTest(unittest.TestCase):
phi = 0.
c = sinusoidal(p0, amp, T, phi, 0., 20.)
self.assertTrue(isclose(c(0), p0).all())
self.assertTrue(isclose(c(T), p0).all())
self.assertTrue(isclose(c(T / 2.), p0).all())
......@@ -88,7 +86,7 @@ class SinusoidalCurveTest(unittest.TestCase):
self.assertTrue(isclose(c.derivate(0., 1), (amp * 2. * np.pi / T)).all())
self.assertTrue(isclose(c.derivate(T, 1), (amp * 2. * np.pi / T)).all())
self.assertTrue(isclose(c.derivate(T / 2., 1), (- amp * 2. * np.pi / T)).all())
self.assertTrue(isclose(c.derivate(T / 2., 1), (-amp * 2. * np.pi / T)).all())
self.assertTrue(isclose(c.derivate(T / 4., 1), np.zeros(3)).all())
self.assertTrue(isclose(c.derivate(3. * T / 4., 1), np.zeros(3)).all())
......@@ -122,7 +120,6 @@ class SinusoidalCurveTest(unittest.TestCase):
self.assertTrue(isclose(c_deriv(T), c.derivate(T, i)).all())
self.assertTrue(isclose(c_deriv(T * 2.), c.derivate(T * 2., i)).all())
def test_comparator(self):
p0 = array([1, -23., 5.])
amp = array([-1, 0.6, 2.8])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment