From: Philippe Proulx Date: Thu, 10 Sep 2020 20:47:52 +0000 (-0400) Subject: Fix: bt2: _trim_docstring(): docstring can have 0 or 1 line X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=ade5c95e2a4f90f839f222fc1a66175b3b199922;hp=ade5c95e2a4f90f839f222fc1a66175b3b199922;p=babeltrace.git Fix: bt2: _trim_docstring(): docstring can have 0 or 1 line It is possible that a user component class's docstring has no lines or a single one, for example: # no line class MySink(bt2._UserSinkComponent): """""" def _user_consume(self): pass # single line class MySink(bt2._UserSinkComponent): """The single line""" def _user_consume(self): pass The previous version of _trim_docstring() expects this format: class MySink(bt2._UserSinkComponent): """ My sink's description Dolore officia ex et aliquip eiusmod enim pariatur reprehenderit ad adipisicing non occaecat ullamco aliquip laborum duis proident ex duis. Irure commodo proident esse non pariatur in aute cillum id aute. """ def _user_consume(self): pass In _trim_docstring(), accept no lines or a single one. Adding new tests to `test_component_class.py` to validate this behaviour. The # fmt: off """ """ # fmt: on docstring has off/on formatting markers as Black 20.8b1 transforms this into the non-equivalent """""" (which is another test now). Signed-off-by: Philippe Proulx Change-Id: Ia12b0e9bfd4d1e1aaa86f0c8c207c3c1535f5c3e Reviewed-on: https://review.lttng.org/c/babeltrace/+/4072 ---