Skip to content

Commit 32d0c6f

Browse files
committed
test/python: test copy and deepcopy
1 parent a3fa6f9 commit 32d0c6f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

unittest/python/bindings_SE3.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pinocchio as pin
33
import numpy as np
44
from pinocchio.utils import eye,zero,rand
5+
from copy import deepcopy, copy
56

67
ones = lambda n: np.ones([n, 1] if isinstance(n, int) else n)
78

@@ -158,5 +159,17 @@ def test_several_init(self):
158159
s = r.__str__()
159160
self.assertTrue(s != '')
160161

162+
def test_copy(self):
163+
M = pin.SE3.Random()
164+
Mc = copy(M)
165+
Mdc = deepcopy(M)
166+
self.assertTrue(M == Mc)
167+
self.assertTrue(M == Mdc)
168+
169+
Mc.setRandom()
170+
self.assertFalse(M == Mc)
171+
Mdc.setRandom()
172+
self.assertFalse(M == Mc)
173+
161174
if __name__ == '__main__':
162175
unittest.main()

0 commit comments

Comments
 (0)