Fix: bt2: _trim_docstring(): docstring can have 0 or 1 line
[babeltrace.git] / tests / bindings / python / bt2 / test_component_class.py
index 685a0b996487f7ba75b607a263270f0561972ecc..bee368a13055f0553b0307358419f483ea65aa91 100644 (file)
@@ -114,16 +114,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):
             """
This page took 0.025297 seconds and 4 git commands to generate.