Update style in test_publisher

This commit is contained in:
Christophe Bedard 2019-11-16 15:09:26 -08:00
parent 3c3a575c80
commit ff4155ab84

View file

@ -39,7 +39,8 @@ class TestPublisher(TraceTestCase):
for event in pub_init_events:
self.assertValidHandle(
event,
['publisher_handle', 'node_handle', 'rmw_publisher_handle'])
['publisher_handle', 'node_handle', 'rmw_publisher_handle'],
)
self.assertValidQueueDepth(event, 'queue_depth')
self.assertStringFieldNotEmpty(event, 'topic_name')
@ -48,11 +49,13 @@ class TestPublisher(TraceTestCase):
test_pub_init_topic_events = self.get_events_with_field_value(
'topic_name',
'/the_topic',
test_pub_init_events)
test_pub_init_events,
)
self.assertNumEventsEqual(
test_pub_init_topic_events,
1,
'none or more than 1 pub_init even for test topic')
'none or more than 1 rcl_pub_init even for test topic',
)
# Check queue_depth value
test_pub_init_topic_event = test_pub_init_topic_events[0]
@ -60,23 +63,27 @@ class TestPublisher(TraceTestCase):
test_pub_init_topic_event,
'queue_depth',
10,
'pub_init event does not have expected queue depth value')
'pub_init event does not have expected queue depth value',
)
# Check that the node handle matches with the node_init event
node_init_events = self.get_events_with_name('ros2:rcl_node_init')
test_pub_node_init_events = self.get_events_with_procname(
'test_publisher',
node_init_events)
node_init_events,
)
self.assertNumEventsEqual(
test_pub_node_init_events,
1,
'none or more than 1 node_init event')
'none or more than 1 node_init event',
)
test_pub_node_init_event = test_pub_node_init_events[0]
self.assertMatchingField(
test_pub_node_init_event,
'node_handle',
None,
test_pub_init_events)
test_pub_init_events,
)
if __name__ == '__main__':