bt2: add `if __name__ == '__main__'` snippet to all tests
[babeltrace.git] / tests / bindings / python / bt2 / test_query_executor.py
index 500ef9bdb90669b1c4bee423b1c9e008f658982e..000de069a44c3f94dc54b93ae0a89cea5412ec15 100644 (file)
@@ -16,9 +16,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-from bt2 import value
 import unittest
-import copy
 import bt2
 import re
 
@@ -43,6 +41,8 @@ class QueryExecutorTestCase(unittest.TestCase):
         }
 
         res = bt2.QueryExecutor(MySink, 'obj', params).query()
+        self.assertIs(type(res), bt2._MapValueConst)
+        self.assertIs(type(res['bt2']), bt2._StringValueConst)
         self.assertEqual(query_params, params)
         self.assertEqual(res, {'null': None, 'bt2': 'BT2'})
         del query_params
@@ -58,7 +58,7 @@ class QueryExecutorTestCase(unittest.TestCase):
                 query_params = params
 
         query_params = 23
-        res = bt2.QueryExecutor(MySink, 'obj', None).query()
+        bt2.QueryExecutor(MySink, 'obj', None).query()
         self.assertIs(query_params, None)
         del query_params
 
@@ -73,7 +73,7 @@ class QueryExecutorTestCase(unittest.TestCase):
                 query_params = params
 
         query_params = 23
-        res = bt2.QueryExecutor(MySink, 'obj').query()
+        bt2.QueryExecutor(MySink, 'obj').query()
         self.assertIs(query_params, None)
         del query_params
 
@@ -89,7 +89,7 @@ class QueryExecutorTestCase(unittest.TestCase):
 
         query_method_obj = None
         method_obj = object()
-        res = bt2.QueryExecutor(MySink, 'obj', method_obj=method_obj).query()
+        bt2.QueryExecutor(MySink, 'obj', method_obj=method_obj).query()
         self.assertIs(query_method_obj, method_obj)
         del query_method_obj
 
@@ -127,7 +127,7 @@ class QueryExecutorTestCase(unittest.TestCase):
                 query_method_obj = method_obj
 
         query_method_obj = object()
-        res = bt2.QueryExecutor(MySink, 'obj').query()
+        bt2.QueryExecutor(MySink, 'obj').query()
         self.assertIsNone(query_method_obj)
         del query_method_obj
 
@@ -170,10 +170,10 @@ class QueryExecutorTestCase(unittest.TestCase):
                 raise ValueError
 
         with self.assertRaises(bt2._Error) as ctx:
-            res = bt2.QueryExecutor(MySink, 'obj', [17, 23]).query()
+            bt2.QueryExecutor(MySink, 'obj', [17, 23]).query()
 
         exc = ctx.exception
-        self.assertEqual(len(exc), 2)
+        self.assertEqual(len(exc), 3)
         cause = exc[0]
         self.assertIsInstance(cause, bt2._ComponentClassErrorCause)
         self.assertIn('raise ValueError', cause.message)
@@ -190,7 +190,7 @@ class QueryExecutorTestCase(unittest.TestCase):
                 raise bt2.UnknownObject
 
         with self.assertRaises(bt2.UnknownObject):
-            res = bt2.QueryExecutor(MySink, 'obj', [17, 23]).query()
+            bt2.QueryExecutor(MySink, 'obj', [17, 23]).query()
 
     def test_query_logging_level_invalid_type(self):
         class MySink(bt2._UserSinkComponent):
@@ -230,7 +230,7 @@ class QueryExecutorTestCase(unittest.TestCase):
                 raise bt2.TryAgain
 
         with self.assertRaises(bt2.TryAgain):
-            res = bt2.QueryExecutor(MySink, 'obj', [17, 23]).query()
+            bt2.QueryExecutor(MySink, 'obj', [17, 23]).query()
 
     def test_query_add_interrupter(self):
         class MySink(bt2._UserSinkComponent):
@@ -288,3 +288,7 @@ class QueryExecutorTestCase(unittest.TestCase):
             test_priv_query_exec.logging_level
 
         del test_priv_query_exec
+
+
+if __name__ == '__main__':
+    unittest.main()
This page took 0.025665 seconds and 4 git commands to generate.