Пример #1
0
def schema_load_dump_fromros_inverse(msg_rostype, ros_msg, py_inst_expected):
    # msg_rostype is just for info/debug purposes

    schema = create(type(ros_msg))

    marshalled, errors = schema.load(ros_msg)
    assert not errors and marshalled == py_inst_expected

    value, errors = schema.dump(marshalled)
    assert not errors and type(value) == type(ros_msg) and value == ros_msg
Пример #2
0
def schema_dump_load_frompy_inverse(msg_rostype, py_inst, ros_msg_expected):
    # msg_rostype is just for info/debug purposes

    schema = create(type(ros_msg_expected))

    unmarshalled, errors = schema.dump(py_inst)
    assert not errors and type(unmarshalled) == type(
        ros_msg_expected) and unmarshalled == ros_msg_expected

    obj, errors = schema.load(unmarshalled)
    assert not errors and type(obj) == type(py_inst) and obj == py_inst
Пример #3
0
def test_msgduration_py():
    yield gen_pymsg_test, create(std_msgs.Duration), std_msgs.Duration(rospy.Duration(secs=42, nsecs=31)), {'data': {'secs': 42, 'nsecs': 31}}
Пример #4
0
def test_msgtime_py():
    yield gen_pymsg_test, create(std_msgs.Time), std_msgs.Time(rospy.Time(secs=42, nsecs=31)), {'data': {'secs': 42, 'nsecs': 31}}
Пример #5
0
def test_msgstring_py():
    yield gen_pymsg_test, create(std_msgs.String), std_msgs.String(data='fortytwo'), {'data': u'fortytwo'}
Пример #6
0
def test_msgint8_py():
    yield gen_pymsg_test, create(std_msgs.Int8), std_msgs.Int8(data=42), {'data': 42}
Пример #7
0
def test_msgbool_py():
    yield gen_pymsg_test, create(std_msgs.Bool), std_msgs.Bool(data=True), {'data': True}
    yield gen_pymsg_test, create(std_msgs.Bool), std_msgs.Bool(data=False), {'data': False}