2 from utils
import run_in_component_init
5 class StreamTestCase(unittest
.TestCase
):
8 return comp_self
._create
_trace
_class
()
10 self
._tc
= run_in_component_init(f
)
11 self
._sc
= self
._tc
.create_stream_class(assigns_automatic_stream_id
=True)
14 def test_create_default(self
):
15 stream
= self
._tr
.create_stream(self
._sc
)
16 self
.assertIsNone(stream
.name
)
19 stream
= self
._tr
.create_stream(self
._sc
, name
='équidistant')
20 self
.assertEqual(stream
.name
, 'équidistant')
22 def test_invalid_name(self
):
23 with self
.assertRaises(TypeError):
24 self
._tr
.create_stream(self
._sc
, name
=22)
26 def test_stream_class(self
):
27 stream
= self
._tr
.create_stream(self
._sc
)
28 self
.assertEqual(stream
.stream_class
, self
._sc
)
30 def test_invalid_id(self
):
31 sc
= self
._tc
.create_stream_class(assigns_automatic_stream_id
=False)
33 with self
.assertRaises(TypeError):
34 self
._tr
.create_stream(sc
, id='string')