Move to kernel style SPDX license identifiers
[babeltrace.git] / tests / bindings / python / bt2 / test_component_class.py
index 92d051f7ee8a1224a1474caf6d2deb750a6f4de1..685a0b996487f7ba75b607a263270f0561972ecc 100644 (file)
@@ -1,20 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Copyright (C) 2019 EfficiOS Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
 
 import unittest
 import bt2
@@ -26,21 +13,17 @@ class UserComponentClassTestCase(unittest.TestCase):
             cls()
 
     def test_no_init_source(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
+        ):
             pass
 
         self._test_no_init(MySource)
 
     def test_no_init_filter(self):
-        class MyIter(bt2._UserMessageIterator):
-            def __next__(self):
-                raise bt2.Stop
-
-        class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
+        class MyFilter(
+            bt2._UserFilterComponent, message_iterator_class=bt2._UserMessageIterator
+        ):
             pass
 
         self._test_no_init(MyFilter)
@@ -53,53 +36,39 @@ class UserComponentClassTestCase(unittest.TestCase):
         self._test_no_init(MySink)
 
     def test_incomplete_source_no_msg_iter_cls(self):
-        class MyIter(bt2._UserMessageIterator):
-            pass
-
         with self.assertRaises(bt2._IncompleteUserClass):
 
             class MySource(bt2._UserSourceComponent):
                 pass
 
     def test_incomplete_source_wrong_msg_iter_cls_type(self):
-        class MyIter(bt2._UserMessageIterator):
-            pass
-
         with self.assertRaises(bt2._IncompleteUserClass):
 
             class MySource(bt2._UserSourceComponent, message_iterator_class=int):
                 pass
 
     def test_incomplete_filter_no_msg_iter_cls(self):
-        class MyIter(bt2._UserMessageIterator):
-            pass
-
         with self.assertRaises(bt2._IncompleteUserClass):
 
             class MyFilter(bt2._UserFilterComponent):
                 pass
 
     def test_incomplete_sink_no_consume_method(self):
-        class MyIter(bt2._UserMessageIterator):
-            pass
-
         with self.assertRaises(bt2._IncompleteUserClass):
 
             class MySink(bt2._UserSinkComponent):
                 pass
 
     def test_minimal_source(self):
-        class MyIter(bt2._UserMessageIterator):
-            pass
-
-        class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
+        class MySource(
+            bt2._UserSourceComponent, message_iterator_class=bt2._UserMessageIterator
+        ):
             pass
 
     def test_minimal_filter(self):
-        class MyIter(bt2._UserMessageIterator):
-            pass
-
-        class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyIter):
+        class MyFilter(
+            bt2._UserFilterComponent, message_iterator_class=bt2._UserMessageIterator
+        ):
             pass
 
     def test_minimal_sink(self):
This page took 0.025769 seconds and 4 git commands to generate.