X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_event_class.py;h=8b49ffb765081120a34d21dd443dee4c6cd90503;hp=6a6eb4cb81308c55300ef07c828fe18bd17520f5;hb=0235b0db7de5bcacdb3650c92461f2ce5eb2143d;hpb=59225a3e0e13a9c674234755e55055d9ff68d635 diff --git a/tests/bindings/python/bt2/test_event_class.py b/tests/bindings/python/bt2/test_event_class.py index 6a6eb4cb..8b49ffb7 100644 --- a/tests/bindings/python/bt2/test_event_class.py +++ b/tests/bindings/python/bt2/test_event_class.py @@ -1,20 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2019 EfficiOS Inc. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; only version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# import unittest import bt2 @@ -34,7 +21,7 @@ def _create_const_event_class(tc, stream_class): ) class MyIter(bt2._UserMessageIterator): - def __init__(self, self_port_output): + def __init__(self, config, self_port_output): trace = tc() stream = trace.create_stream(stream_class) @@ -99,6 +86,8 @@ class EventClassTestCase(unittest.TestCase): with self.assertRaises(TypeError): sc.create_event_class(id='lel') + self.assertEqual(len(sc), 0) + def test_create_specific_context_field_class(self): fc = self._tc.create_structure_field_class() ec = self._stream_class.create_event_class(specific_context_field_class=fc) @@ -118,6 +107,8 @@ class EventClassTestCase(unittest.TestCase): with self.assertRaises(TypeError): self._stream_class.create_event_class(specific_context_field_class='lel') + self.assertEqual(len(self._stream_class), 0) + def test_create_payload_field_class(self): fc = self._tc.create_structure_field_class() ec = self._stream_class.create_event_class(payload_field_class=fc) @@ -137,6 +128,8 @@ class EventClassTestCase(unittest.TestCase): with self.assertRaises(TypeError): self._stream_class.create_event_class(payload_field_class='lel') + self.assertEqual(len(self._stream_class), 0) + def test_create_name(self): ec = self._stream_class.create_event_class(name='viande à chien') self.assertEqual(ec.name, 'viande à chien') @@ -145,6 +138,8 @@ class EventClassTestCase(unittest.TestCase): with self.assertRaises(TypeError): self._stream_class.create_event_class(name=2) + self.assertEqual(len(self._stream_class), 0) + def test_emf_uri(self): ec = self._stream_class.create_event_class(emf_uri='salut') self.assertEqual(ec.emf_uri, 'salut') @@ -153,6 +148,8 @@ class EventClassTestCase(unittest.TestCase): with self.assertRaises(TypeError): self._stream_class.create_event_class(emf_uri=23) + self.assertEqual(len(self._stream_class), 0) + def test_create_log_level(self): ec = self._stream_class.create_event_class( log_level=bt2.EventClassLogLevel.EMERGENCY @@ -163,6 +160,8 @@ class EventClassTestCase(unittest.TestCase): with self.assertRaises(ValueError): self._stream_class.create_event_class(log_level='zoom') + self.assertEqual(len(self._stream_class), 0) + def test_create_user_attributes(self): ec = self._stream_class.create_event_class(user_attributes={'salut': 23}) self.assertEqual(ec.user_attributes, {'salut': 23}) @@ -176,10 +175,14 @@ class EventClassTestCase(unittest.TestCase): with self.assertRaises(TypeError): self._stream_class.create_event_class(user_attributes=object()) + self.assertEqual(len(self._stream_class), 0) + def test_create_invalid_user_attributes_value_type(self): with self.assertRaises(TypeError): self._stream_class.create_event_class(user_attributes=23) + self.assertEqual(len(self._stream_class), 0) + def test_stream_class(self): ec = self._stream_class.create_event_class() self.assertEqual(ec.stream_class.addr, self._stream_class.addr)