Skip to content

Commit 1fb1b5d

Browse files
committed
Using check=False seems to return empty types
1 parent 3f06d5e commit 1fb1b5d

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

‎tests/test_quaternion.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,9 @@ def test_constructor(self):
892892
# tc.verifyError( @() Quaternion(2), 'SMTB:Quaternion:badarg')
893893
# tc.verifyError( @() Quaternion([1, 2, 3]), 'SMTB:Quaternion:badarg')
894894

895+
# an array that is not a 4-vector must not give an empty Quaternion
896+
self.assertNotEqual(len(Quaternion(np.random.rand(3, 4))), 0)
897+
895898
def test_string(self):
896899
u = Quaternion()
897900

‎tests/test_twist.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ def test_conversion_SE3(self):
6767
T = SE3.Rx(0) * SE3(1, 2, 3)
6868
array_compare(Twist3(T).SE3(), T)
6969

70+
# from an SE(3) matrix, with and without checking
71+
for check in (True, False):
72+
tw = Twist3(T.A, check=check)
73+
self.assertEqual(len(tw), 1)
74+
array_compare(tw.SE3(), T)
75+
7076
def test_conversion_se3(self):
7177
s = [1, 2, 3, 4, 5, 6]
7278
x = Twist3(s)
@@ -83,6 +89,12 @@ def test_conversion_se3(self):
8389
),
8490
)
8591

92+
# from an se(3) matrix, with and without checking
93+
for check in (True, False):
94+
tw = Twist3(x.skewa(), check=check)
95+
self.assertEqual(len(tw), 1)
96+
array_compare(tw, x)
97+
8698
def test_conversion_Plucker(self):
8799
pass
88100

@@ -271,6 +283,12 @@ def test_conversion_SE2(self):
271283
self.assertIsInstance(tw.SE2(), SE2)
272284
self.assertEqual(len(tw.SE2()), 1)
273285

286+
# from an SE(2) matrix, with and without checking
287+
for check in (True, False):
288+
tw = Twist2(T.A, check=check)
289+
self.assertEqual(len(tw), 1)
290+
array_compare(tw.SE2(), T)
291+
274292
def test_conversion_se2(self):
275293
s = [1, 2, 3]
276294
x = Twist2(s)
@@ -279,6 +297,12 @@ def test_conversion_se2(self):
279297
x.skewa(), np.array([[0.0, -3.0, 1.0], [3.0, 0.0, 2.0], [0.0, 0.0, 0.0]])
280298
)
281299

300+
# from an se(2) matrix, with and without checking
301+
for check in (True, False):
302+
tw = Twist2(x.skewa(), check=check)
303+
self.assertEqual(len(tw), 1)
304+
array_compare(tw, x)
305+
282306
def test_list_constuctor(self):
283307
x = Twist2([1, 0, 0])
284308

0 commit comments

Comments
 (0)