From feb5fe23a635825a74165977d7e6e4389d052e8d Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 7 Feb 2017 20:20:07 -0500 Subject: [PATCH] bt2: test comp. class help attribute MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- .../python/bt2/test_comp_notif_iter.py | 84 ++++++++++++++++++- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/tests/bindings/python/bt2/test_comp_notif_iter.py b/tests/bindings/python/bt2/test_comp_notif_iter.py index b13294af6..223cab02b 100644 --- a/tests/bindings/python/bt2/test_comp_notif_iter.py +++ b/tests/bindings/python/bt2/test_comp_notif_iter.py @@ -122,13 +122,52 @@ class GenCompClassTestCase(unittest.TestCase): def test_attr_description(self): class MySink(bt2.UserSinkComponent): - 'hello' + '''This is the description. + + This is the help. + + This too: + + * And this. + * And also that. + + Voilà. + ''' + + def _consume(self): + pass + + sink = MySink() + self.assertEqual(sink.component_class.description, + 'This is the description.') + + def test_attr_help(self): + class MySink(bt2.UserSinkComponent): + '''This is the description. + + This is the help. + + This too: + + * And this. + * And also that. + + Voilà. + ''' def _consume(self): pass sink = MySink() - self.assertEqual(sink.component_class.description, 'hello') + expected_help = '''This is the help. + +This too: + + * And this. + * And also that. + +Voilà.''' + self.assertEqual(sink.component_class.help, expected_help) def test_instantiate(self): class MySink(bt2.UserSinkComponent): @@ -173,12 +212,49 @@ class UserCompClassTestCase(unittest.TestCase): def test_attr_description(self): class MySink(bt2.UserSinkComponent): - 'here is your description' + '''This is the description. + + This is the help. + + This too: + + * And this. + * And also that. + + Voilà. + ''' + + def _consume(self): + pass + + self.assertEqual(MySink.description, 'This is the description.') + + def test_attr_help(self): + class MySink(bt2.UserSinkComponent): + '''This is the description. + + This is the help. + + This too: + + * And this. + * And also that. + + Voilà. + ''' def _consume(self): pass - self.assertEqual(MySink.description, 'here is your description') + expected_help = '''This is the help. + +This too: + + * And this. + * And also that. + +Voilà.''' + self.assertEqual(MySink.help, expected_help) def test_init(self): class MySink(bt2.UserSinkComponent): -- 2.34.1