test_outgoing_message.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rosunit
3 import sys
4 import unittest
5 
6 from rosbridge_library.internal.outgoing_message import OutgoingMessage
7 from std_msgs.msg import String
8 
9 
10 PKG = 'rosbridge_library'
11 NAME = 'test_outgoing_message'
12 
13 
14 class TestOutgoingMessage(unittest.TestCase):
15  def test_json_values(self):
16  msg = String(data="foo")
17  outgoing = OutgoingMessage(msg)
18 
19  result = outgoing.get_json_values()
20  self.assertEqual(result['data'], msg.data)
21 
22  again = outgoing.get_json_values()
23  self.assertTrue(result is again)
24 
25  def test_cbor_values(self):
26  msg = String(data="foo")
27  outgoing = OutgoingMessage(msg)
28 
29  result = outgoing.get_cbor_values()
30  self.assertEqual(result['data'], msg.data)
31 
32  again = outgoing.get_cbor_values()
33  self.assertTrue(result is again)
34 
35 
36 if __name__ == '__main__':
37  rosunit.unitrun(PKG, NAME, TestOutgoingMessage)
msg
test.internal.test_outgoing_message.TestOutgoingMessage.test_json_values
def test_json_values(self)
Definition: test_outgoing_message.py:15
test.internal.test_outgoing_message.TestOutgoingMessage
Definition: test_outgoing_message.py:14
rosbridge_library.internal.outgoing_message
Definition: outgoing_message.py:1
rosbridge_library.internal.outgoing_message.OutgoingMessage
Definition: outgoing_message.py:10
test.internal.test_outgoing_message.TestOutgoingMessage.test_cbor_values
def test_cbor_values(self)
Definition: test_outgoing_message.py:25


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Tue Oct 3 2023 02:12:45