ctf: remove `intersection-range-ns` from `babeltrace.trace-info` query
[babeltrace.git] / tests / bindings / python / bt2 / test_trace.py
index 85615b4b515ba7d001e15fc80661af24c848daa3..0cb3b94eb46b6386c640782df03511b803131afd 100644 (file)
@@ -29,12 +29,25 @@ class TraceTestCase(unittest.TestCase):
         trace = self._tc()
         self.assertIsNone(trace.name)
         self.assertIsNone(trace.uuid)
-        self.assertEqual(len(trace.env), 0)
+        self.assertEqual(len(trace.environment), 0)
+        self.assertEqual(len(trace.user_attributes), 0)
 
     def test_create_invalid_name(self):
         with self.assertRaises(TypeError):
             self._tc(name=17)
 
+    def test_create_user_attributes(self):
+        trace = self._tc(user_attributes={'salut': 23})
+        self.assertEqual(trace.user_attributes, {'salut': 23})
+
+    def test_create_invalid_user_attributes(self):
+        with self.assertRaises(TypeError):
+            self._tc(user_attributes=object())
+
+    def test_create_invalid_user_attributes_value_type(self):
+        with self.assertRaises(TypeError):
+            self._tc(user_attributes=23)
+
     def test_attr_trace_class(self):
         trace = self._tc()
         self.assertEqual(trace.cls.addr, self._tc.addr)
@@ -48,15 +61,15 @@ class TraceTestCase(unittest.TestCase):
         self.assertEqual(trace.uuid, uuid.UUID('da7d6b6f-3108-4706-89bd-ab554732611b'))
 
     def test_env_get(self):
-        trace = self._tc(env={'hello': 'you', 'foo': -5})
-        self.assertEqual(trace.env['hello'], 'you')
-        self.assertEqual(trace.env['foo'], -5)
+        trace = self._tc(environment={'hello': 'you', 'foo': -5})
+        self.assertEqual(trace.environment['hello'], 'you')
+        self.assertEqual(trace.environment['foo'], -5)
 
     def test_env_get_non_existent(self):
-        trace = self._tc(env={'hello': 'you', 'foo': -5})
+        trace = self._tc(environment={'hello': 'you', 'foo': -5})
 
         with self.assertRaises(KeyError):
-            trace.env['lel']
+            trace.environment['lel']
 
     def test_len(self):
         trace = self._tc()
This page took 0.024018 seconds and 4 git commands to generate.