def test_publish(self):
        topic = "/test_publish"
        msg_type = "std_msgs/String"
        msg = {"data": "why halo thar"}

        received = {"msg": None}
        def cb(msg):
            received["msg"] = msg

        rospy.Subscriber(topic, ros_loader.get_message_class(msg_type), cb)
        p = MultiPublisher(topic, msg_type)
        p.publish(msg)

        sleep(0.5)

        self.assertEqual(received["msg"].data, msg["data"])
Make sure that publishing works
dataset/ETHPy150Open RobotWebTools/rosbridge_suite/rosbridge_library/test/internal/publishers/test_multi_publisher.py/TestMultiPublisher.test_publish