bt2: add user attributes property support
[babeltrace.git] / tests / bindings / python / bt2 / test_stream_class.py
index 473efca7923aa1468195cfa4ffdcc3983a0cb2d6..60b86883439319d6fb30ce78607ddb839d05410e 100644 (file)
@@ -46,6 +46,7 @@ class StreamClassTestCase(unittest.TestCase):
         self.assertFalse(sc.discarded_events_have_default_clock_snapshots)
         self.assertFalse(sc.supports_discarded_packets)
         self.assertFalse(sc.discarded_packets_have_default_clock_snapshots)
+        self.assertEqual(len(sc.user_attributes), 0)
 
     def test_create_name(self):
         sc = self._tc.create_stream_class(name='bozo')
@@ -89,6 +90,18 @@ class StreamClassTestCase(unittest.TestCase):
         with self.assertRaises(TypeError):
             self._tc.create_stream_class(default_clock_class=12)
 
+    def test_create_user_attributes(self):
+        sc = self._tc.create_stream_class(user_attributes={'salut': 23})
+        self.assertEqual(sc.user_attributes, {'salut': 23})
+
+    def test_create_invalid_user_attributes(self):
+        with self.assertRaises(TypeError):
+            self._tc.create_stream_class(user_attributes=object())
+
+    def test_create_invalid_user_attributes_value_type(self):
+        with self.assertRaises(TypeError):
+            self._tc.create_stream_class(user_attributes=23)
+
     def test_automatic_stream_ids(self):
         sc = self._tc.create_stream_class(assigns_automatic_stream_id=True)
         self.assertTrue(sc.assigns_automatic_stream_id)
This page took 0.0228 seconds and 4 git commands to generate.