X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_graph.py;h=5eb83f4097c6079178c4a039245082c10e50d2e0;hb=fbd8a4e0144aa7777bedcd8c05daec61d594634d;hp=f96c8d633c999e0379cb87d4ba8da426599836b8;hpb=f09b3ae994955a5f6a2baca18091ed5f7d035183;p=babeltrace.git diff --git a/tests/bindings/python/bt2/test_graph.py b/tests/bindings/python/bt2/test_graph.py index f96c8d63..5eb83f40 100644 --- a/tests/bindings/python/bt2/test_graph.py +++ b/tests/bindings/python/bt2/test_graph.py @@ -216,11 +216,9 @@ class GraphTestCase(unittest.TestCase): self.assertEqual(comp.logging_level, bt2.LoggingLevel.DEBUG) def test_connect_ports(self): - class MyIter(bt2._UserMessageIterator): - def __next__(self): - raise bt2.Stop - - class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter): + class MySource( + bt2._UserSourceComponent, message_iterator_class=bt2._UserMessageIterator + ): def __init__(self, config, params, obj): self._add_output_port('out') @@ -243,11 +241,9 @@ class GraphTestCase(unittest.TestCase): self.assertEqual(sink.input_ports['in'].connection.addr, conn.addr) def test_connect_ports_invalid_direction(self): - class MyIter(bt2._UserMessageIterator): - def __next__(self): - raise bt2.Stop - - class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter): + class MySource( + bt2._UserSourceComponent, message_iterator_class=bt2._UserMessageIterator + ): def __init__(self, config, params, obj): self._add_output_port('out') @@ -281,9 +277,7 @@ class GraphTestCase(unittest.TestCase): next(self._msg_iter) def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) # add two interrupters, set one of them interrupter1 = bt2.Interrupter() @@ -329,9 +323,7 @@ class GraphTestCase(unittest.TestCase): return next(self._msg_iter) def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_ports['in'] - ) + self._msg_iter = self._create_message_iterator(self._input_ports['in']) graph = self._graph up = self._graph.add_component(MySource, 'down') @@ -388,9 +380,7 @@ class GraphTestCase(unittest.TestCase): comp_self._at += 1 def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_port - ) + self._msg_iter = self._create_message_iterator(self._input_port) src = self._graph.add_component(MySource, 'src') sink = self._graph.add_component(MySink, 'sink') @@ -486,9 +476,7 @@ class GraphTestCase(unittest.TestCase): comp_self._at += 1 def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_port - ) + self._msg_iter = self._create_message_iterator(self._input_port) src = self._graph.add_component(MySource, 'src') sink = self._graph.add_component(MySink, 'sink') @@ -543,9 +531,7 @@ class GraphTestCase(unittest.TestCase): comp_self._at += 1 def _user_graph_is_configured(self): - self._msg_iter = self._create_input_port_message_iterator( - self._input_port - ) + self._msg_iter = self._create_message_iterator(self._input_port) src = self._graph.add_component(MySource, 'src') sink = self._graph.add_component(MySink, 'sink') @@ -555,11 +541,9 @@ class GraphTestCase(unittest.TestCase): self._graph.run() def test_listeners(self): - class MyIter(bt2._UserMessageIterator): - def __next__(self): - raise bt2.Stop - - class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter): + class MySource( + bt2._UserSourceComponent, message_iterator_class=bt2._UserMessageIterator + ): def __init__(self, config, params, obj): self._add_output_port('out') self._add_output_port('zero') @@ -603,11 +587,9 @@ class GraphTestCase(unittest.TestCase): self.assertEqual(calls[3][2].name, 'taste') def test_invalid_listeners(self): - class MyIter(bt2._UserMessageIterator): - def __next__(self): - raise bt2.Stop - - class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter): + class MySource( + bt2._UserSourceComponent, message_iterator_class=bt2._UserMessageIterator + ): def __init__(self, config, params, obj): self._add_output_port('out') self._add_output_port('zero')