14 PKG =
'rosbridge_library' 15 NAME =
'test_multi_unregistering' 21 rospy.init_node(NAME, log_level=rospy.DEBUG)
24 """ Make sure that publishing works """ 25 topic =
"/test_publish_once" 26 msg_type =
"std_msgs/String" 27 msg = {
"data":
"why halo thar"}
29 received = {
"msg":
None}
34 rospy.Subscriber(topic, ros_loader.get_message_class(msg_type), cb)
40 self.assertEqual(received[
"msg"].data, msg[
"data"])
43 """ Make sure that publishing works """ 44 topic =
"/test_publish_twice" 45 msg_type =
"std_msgs/String" 46 msg = {
"data":
"why halo thar"}
48 received = {
"msg":
None}
53 rospy.Subscriber(topic, ros_loader.get_message_class(msg_type), cb)
59 self.assertEqual(received[
"msg"].data, msg[
"data"])
64 received[
"msg"] =
None 65 self.assertIsNone(received[
"msg"])
71 self.assertEqual(received[
"msg"].data, msg[
"data"])
74 if __name__ ==
'__main__':
75 rosunit.unitrun(PKG, NAME, TestMultiUnregistering)
def test_publish_twice(self)
def test_publish_once(self)