def test_check_type(self): # check_type() currently does not do harder checks like # type-checking class types. as soon as it does, it will need # test to validate this. from roslib.message import check_type, SerializationError from roslib.rostime import Time, Duration valids = [ ('byte', 1), ('byte', -1), ('string', ''), ('string', 'a string of text'), ('int32[]', []), ('int32[]', [1, 2, 3, 4]), ('time', Time()), ('time', Time.from_seconds(1.0)), ('time', Time(10000)), ('time', Time(1000, -100)), ('duration', Duration()), ('duration', Duration()), ('duration', Duration(100)), ('duration', Duration(-100, -100)), ] for t, v in valids: try: check_type('n', t, v) except Exception, e: traceback.print_exc() raise Exception("failure type[%s] value[%s]: %s" % (t, v, str(e)))