Fix: bt2: _trim_docstring(): docstring can have 0 or 1 line
[babeltrace.git] / tests / bindings / python / bt2 / test_component_class.py
index 4f6978e74bbaeeea1203b74daed12491f122815d..acb2e8b260782913d70ab06b97ea6bab3d17d773 100644 (file)
@@ -127,16 +127,38 @@ class UserComponentClassTestCase(unittest.TestCase):
 
         self.assertEqual(MySink.description, 'The description.')
 
-    def test_empty_description(self):
+    def test_empty_description_no_lines(self):
         class MySink(bt2._UserSinkComponent):
+            # fmt: off
+            """"""
+            # fmt: on
+
+            def _user_consume(self):
+                pass
+
+        self.assertIsNone(MySink.description)
+
+    def test_empty_description_no_contents(self):
+        class MySink(bt2._UserSinkComponent):
+            # fmt: off
             """
             """
+            # fmt: on
 
             def _user_consume(self):
                 pass
 
         self.assertIsNone(MySink.description)
 
+    def test_empty_description_single_line(self):
+        class MySink(bt2._UserSinkComponent):
+            """my description"""
+
+            def _user_consume(self):
+                pass
+
+        self.assertEqual(MySink.description, "my description")
+
     def test_help(self):
         class MySink(bt2._UserSinkComponent):
             """
@@ -291,11 +313,11 @@ class UserComponentClassTestCase(unittest.TestCase):
 class ComponentClassTestCase(unittest.TestCase):
     def setUp(self):
         class MySink(bt2._UserSinkComponent):
-            '''
+            """
             The description.
 
             The help.
-            '''
+            """
 
             def _user_consume(self):
                 pass
This page took 0.023615 seconds and 4 git commands to generate.