+ def test_create_user_attributes(self):
+ def f(comp_self):
+ return comp_self._create_clock_class(user_attributes={"salut": 23})
+
+ cc = run_in_component_init(f)
+ self.assertEqual(cc.user_attributes, {"salut": 23})
+ self.assertIs(type(cc.user_attributes), bt2_value.MapValue)
+
+ def test_create_invalid_user_attributes(self):
+ def f(comp_self):
+ return comp_self._create_clock_class(user_attributes=object())
+
+ self.assertRaisesInComponentInit(TypeError, f)
+
+ def test_create_invalid_user_attributes_value_type(self):
+ def f(comp_self):
+ return comp_self._create_clock_class(user_attributes=23)
+
+ self.assertRaisesInComponentInit(TypeError, f)
+
+ def test_const_user_attributes(self):
+ cc = utils.get_const_event_message().default_clock_snapshot.clock_class
+ self.assertIs(type(cc.user_attributes), bt2_value._MapValueConst)
+