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
58 self.
helperhelper = ByteStringTestHelper()
61 self.assertTrue(self.
helperhelper.compareEmbeddedZeros(b
"\xff\xef\x00\x10"))
65 self.assertEqual(self.
helperhelper.getBytesPChar(), b
"abcdef")
69 self.assertEqual(self.
helperhelper.getBytesStdString(), b
"\xff\xfe\x10\x00\x00")
72 self.assertEqual(self.
helperhelper.getDefaultBytes(), b
"")
76 ans = self.
helperhelper.getTuple()
77 self.assertIsInstance(ans, tuple)
78 self.assertEqual(len(ans), 1)
79 self.assertEqual(ans[0], b
"abcdef")
83 self.assertTrue(self.
helperhelper.compareTuple((b
"mno",)))
87 Vector3(x=1.0, y=-2.0, z=0.25).serialize(tmp)
88 self.assertTrue(self.
helperhelper.compareVector(tmp.getvalue()))
92 tmp.deserialize(self.
helperhelper.getVector())
93 self.assertEqual(tmp, Vector3(1.0, -2.0, 0.25))
96 with self.assertRaisesRegexp(Exception,
"Python argument types in"):
97 self.
helperhelper.compareEmbeddedZeros(4711)
100 with self.assertRaisesRegexp(Exception,
"Python argument types in"):
101 self.
helperhelper.compareEmbeddedZeros((4711,))
104 with self.assertRaisesRegexp(Exception,
"Python argument types in"):
105 self.
helperhelper.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.
helperhelper.compareVectorTuple((
u"kdasd",))
115 if __name__ ==
"__main__":
def test_recieveMessage(self)
def test_ByteStringDefaultCtor(self)
def test_ByteStringFromPchar(self)
def test_rejectUnicodeTuple(self)
def test_PyTupleToCxx(self)
def test_rejectUnicode(self)
def test_rejectIntTuple(self)
def test_CxxTupleToPy(self)
def test_sendMessage(self)
def test_ByteStringFromStdString(self)
def test_EmbeddedZeros(self)