lib: bt_graph_create(): accept MIP version
[babeltrace.git] / tests / bindings / python / bt2 / test_component.py
index 24f056f18c3736c92b05cb3b1f54fc044db4204e..65338c199b5946b5e7da0ce586dea54d281527d4 100644 (file)
@@ -1,6 +1,22 @@
-from bt2 import value
+#
+# 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 copy
 import bt2
 
 
@@ -16,41 +32,51 @@ class UserComponentTestCase(unittest.TestCase):
 
     def test_name(self):
         class MySink(bt2._UserSinkComponent):
-            def __init__(comp_self, params):
+            def __init__(comp_self, params, obj):
                 self.assertEqual(comp_self.name, 'yaes')
 
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
         comp = self._create_comp(MySink, 'yaes')
 
     def test_logging_level(self):
         class MySink(bt2._UserSinkComponent):
-            def __init__(comp_self, params):
+            def __init__(comp_self, params, obj):
                 self.assertEqual(comp_self.logging_level, bt2.LoggingLevel.INFO)
 
-            def _consume(self):
+            def _user_consume(self):
+                pass
+
+        comp = self._create_comp(MySink, 'yaes', bt2.LoggingLevel.INFO)
+
+    def test_graph_mip_version(self):
+        class MySink(bt2._UserSinkComponent):
+            def __init__(comp_self, params, obj):
+                self.assertEqual(comp_self._graph_mip_version, 0)
+
+            def _user_consume(self):
                 pass
 
         comp = self._create_comp(MySink, 'yaes', bt2.LoggingLevel.INFO)
 
     def test_class(self):
         class MySink(bt2._UserSinkComponent):
-            def __init__(comp_self, params):
+            def __init__(comp_self, params, obj):
                 self.assertEqual(comp_self.cls, MySink)
 
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
         self._create_comp(MySink)
 
     def test_addr(self):
         class MySink(bt2._UserSinkComponent):
-            def __init__(comp_self, params):
+            def __init__(comp_self, params, obj):
                 self.assertIsInstance(comp_self.addr, int)
                 self.assertNotEqual(comp_self.addr, 0)
 
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
         self._create_comp(MySink)
@@ -59,10 +85,10 @@ class UserComponentTestCase(unittest.TestCase):
         finalized = False
 
         class MySink(bt2._UserSinkComponent):
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
-            def _finalize(comp_self):
+            def _user_finalize(comp_self):
                 nonlocal finalized
                 finalized = True
 
@@ -86,7 +112,7 @@ class GenericComponentTestCase(unittest.TestCase):
 
     def test_name(self):
         class MySink(bt2._UserSinkComponent):
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
         comp = self._create_comp(MySink, 'yaes')
@@ -94,15 +120,15 @@ class GenericComponentTestCase(unittest.TestCase):
 
     def test_logging_level(self):
         class MySink(bt2._UserSinkComponent):
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
-        comp = self._create_comp(MySink, 'yaes', bt2.LoggingLevel.WARN)
-        self.assertEqual(comp.logging_level, bt2.LoggingLevel.WARN)
+        comp = self._create_comp(MySink, 'yaes', bt2.LoggingLevel.WARNING)
+        self.assertEqual(comp.logging_level, bt2.LoggingLevel.WARNING)
 
     def test_class(self):
         class MySink(bt2._UserSinkComponent):
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
         comp = self._create_comp(MySink)
@@ -110,7 +136,7 @@ class GenericComponentTestCase(unittest.TestCase):
 
     def test_addr(self):
         class MySink(bt2._UserSinkComponent):
-            def _consume(self):
+            def _user_consume(self):
                 pass
 
         comp = self._create_comp(MySink)
This page took 0.024278 seconds and 4 git commands to generate.