7 class UserComponentTestCase(unittest
.TestCase
):
9 def _create_comp(comp_cls
, name
=None):
15 return graph
.add_component(comp_cls
, name
)
18 class MySink(bt2
._UserSinkComponent
):
19 def __init__(comp_self
, params
):
20 self
.assertEqual(comp_self
.name
, 'yaes')
25 comp
= self
._create
_comp
(MySink
, 'yaes')
28 class MySink(bt2
._UserSinkComponent
):
29 def __init__(comp_self
, params
):
30 self
.assertEqual(comp_self
.component_class
, MySink
)
35 self
._create
_comp
(MySink
)
38 class MySink(bt2
._UserSinkComponent
):
39 def __init__(comp_self
, params
):
40 self
.assertIsInstance(comp_self
.addr
, int)
41 self
.assertNotEqual(comp_self
.addr
, 0)
46 self
._create
_comp
(MySink
)
48 def test_finalize(self
):
51 class MySink(bt2
._UserSinkComponent
):
55 def _finalize(comp_self
):
60 comp
= graph
.add_component(MySink
, 'lel')
64 self
.assertTrue(finalized
)
67 class GenericComponentTestCase(unittest
.TestCase
):
69 def _create_comp(comp_cls
, name
=None):
75 return graph
.add_component(comp_cls
, name
)
78 class MySink(bt2
._UserSinkComponent
):
82 comp
= self
._create
_comp
(MySink
, 'yaes')
83 self
.assertEqual(comp
.name
, 'yaes')
86 class MySink(bt2
._UserSinkComponent
):
90 comp
= self
._create
_comp
(MySink
)
91 self
.assertEqual(comp
.component_class
, MySink
)
94 class MySink(bt2
._UserSinkComponent
):
98 comp
= self
._create
_comp
(MySink
)
99 self
.assertIsInstance(comp
.addr
, int)
100 self
.assertNotEqual(comp
.addr
, 0)
This page took 0.030853 seconds and 4 git commands to generate.