38 from moveit_ros_planning_interface._moveit_planning_interface_test_serialize_msg_cpp_helper
import (
41 from geometry_msgs.msg
import Vector3
46 from StringIO
import StringIO
51 from io
import BytesIO
as StringIO
61 self.assertTrue(self.
helper.compareEmbeddedZeros(b
"\xff\xef\x00\x10"))
65 self.assertEqual(self.
helper.getBytesPChar(), b
"abcdef")
69 self.assertEqual(self.
helper.getBytesStdString(), b
"\xff\xfe\x10\x00\x00")
72 self.assertEqual(self.
helper.getDefaultBytes(), b
"")
76 ans = self.
helper.getTuple()
77 self.assertIsInstance(ans, tuple)
78 self.assertEqual(len(ans), 1)
79 self.assertEqual(ans[0], b
"abcdef")
83 self.assertTrue(self.
helper.compareTuple((b
"mno",)))
87 Vector3(x=1.0, y=-2.0, z=0.25).serialize(tmp)
88 self.assertTrue(self.
helper.compareVector(tmp.getvalue()))
92 tmp.deserialize(self.
helper.getVector())
93 self.assertEqual(tmp, Vector3(1.0, -2.0, 0.25))
96 with self.assertRaisesRegexp(Exception,
"Python argument types in"):
97 self.
helper.compareEmbeddedZeros(4711)
100 with self.assertRaisesRegexp(Exception,
"Python argument types in"):
101 self.
helper.compareEmbeddedZeros((4711,))
104 with self.assertRaisesRegexp(Exception,
"Python argument types in"):
105 self.
helper.compareEmbeddedZeros(
u"kdasd")
107 @unittest.skipIf(py_version_maj == 2,
"does not trigger with python 2.7")
109 with self.assertRaisesRegexp(
110 RuntimeError,
"Underlying python object is not a Bytes/String instance"
112 self.
helper.compareVectorTuple((
u"kdasd",))
115 if __name__ ==
"__main__":