tests: Add missing copyright headers
[babeltrace.git] / tests / bindings / python / bt2 / test_stream.py
1 #
2 # Copyright (C) 2019 EfficiOS Inc.
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; only version 2
7 # of the License.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #
18
19 import unittest
20 from utils import run_in_component_init
21
22
23 class StreamTestCase(unittest.TestCase):
24 def setUp(self):
25 def f(comp_self):
26 return comp_self._create_trace_class()
27
28 self._tc = run_in_component_init(f)
29 self._sc = self._tc.create_stream_class(assigns_automatic_stream_id=True)
30 self._tr = self._tc()
31
32 def test_create_default(self):
33 stream = self._tr.create_stream(self._sc)
34 self.assertIsNone(stream.name)
35
36 def test_name(self):
37 stream = self._tr.create_stream(self._sc, name='équidistant')
38 self.assertEqual(stream.name, 'équidistant')
39
40 def test_invalid_name(self):
41 with self.assertRaises(TypeError):
42 self._tr.create_stream(self._sc, name=22)
43
44 def test_stream_class(self):
45 stream = self._tr.create_stream(self._sc)
46 self.assertEqual(stream.cls, self._sc)
47
48 def test_invalid_id(self):
49 sc = self._tc.create_stream_class(assigns_automatic_stream_id=False)
50
51 with self.assertRaises(TypeError):
52 self._tr.create_stream(sc, id='string')
This page took 0.030406 seconds and 4 git commands to generate.