payload_field_class=None):
if self.assigns_automatic_event_class_id:
if id is not None:
- raise bt2.CreationError('id provided, but stream class assigns automatic event class ids')
+ raise ValueError('id provided, but stream class assigns automatic event class ids')
ec_ptr = native_bt.event_class_create(self._ptr)
else:
if id is None:
- raise bt2.CreationError('id not provided, but stream class does not assign automatic event class ids')
+ raise ValueError('id not provided, but stream class does not assign automatic event class ids')
utils._check_uint64(id)
ec_ptr = native_bt.event_class_create_with_id(self._ptr, id)
if stream_class.assigns_automatic_stream_id:
if id is not None:
- raise bt2.CreationError("id provided, but stream class assigns automatic stream ids")
+ raise ValueError("id provided, but stream class assigns automatic stream ids")
stream_ptr = native_bt.stream_create(stream_class._ptr, self._ptr)
else:
if id is None:
- raise bt2.CreationError("id not provided, but stream class does not assign automatic stream ids")
+ raise ValueError("id not provided, but stream class does not assign automatic stream ids")
utils._check_uint64(id)
stream_ptr = native_bt.stream_create_with_id(stream_class._ptr, self._ptr, id)
if self.assigns_automatic_stream_class_id:
if id is not None:
- raise bt2.CreationError('id provided, but trace class assigns automatic stream class ids')
+ raise ValueError('id provided, but trace class assigns automatic stream class ids')
sc_ptr = native_bt.stream_class_create(self._ptr)
else:
if id is None:
- raise bt2.CreationError('id not provided, but trace class does not assign automatic stream class ids')
+ raise ValueError('id not provided, but trace class does not assign automatic stream class ids')
utils._check_uint64(id)
sc_ptr = native_bt.stream_class_create_with_id(self._ptr, id)
sc = self._tc.create_stream_class(assigns_automatic_stream_id=True)
self.assertTrue(sc.assigns_automatic_stream_id)
- with self.assertRaises(bt2.CreationError):
+ with self.assertRaises(ValueError):
self._trace.create_stream(sc, id=123)
def test_no_automatic_stream_ids(self):
sc = self._tc.create_stream_class(assigns_automatic_stream_id=False)
self.assertFalse(sc.assigns_automatic_stream_id)
- with self.assertRaises(bt2.CreationError):
+ with self.assertRaises(ValueError):
self._trace.create_stream(sc)
def test_automatic_event_class_ids(self):
sc = self._tc.create_stream_class(assigns_automatic_event_class_id=True)
self.assertTrue(sc.assigns_automatic_event_class_id)
- with self.assertRaises(bt2.CreationError):
+ with self.assertRaises(ValueError):
sc.create_event_class(id=123)
def test_no_automatic_event_class_ids(self):
sc = self._tc.create_stream_class(assigns_automatic_event_class_id=False)
self.assertFalse(sc.assigns_automatic_event_class_id)
- with self.assertRaises(bt2.CreationError):
+ with self.assertRaises(ValueError):
sc.create_event_class()
def test_packets_have_default_beginning_clock_snapshot(self):
tc = run_in_component_init(f)
self.assertTrue(tc.assigns_automatic_stream_class_id)
- with self.assertRaises(bt2.CreationError):
+ with self.assertRaises(ValueError):
sc1 = tc.create_stream_class(23)
def test_no_assigns_automatic_stream_class_id(self):
self.assertFalse(tc.assigns_automatic_stream_class_id)
# In this mode, it is required to pass an explicit id.
- with self.assertRaises(bt2.CreationError):
+ with self.assertRaises(ValueError):
tc.create_stream_class()
def test_env_get(self):