Return empty string if not docstring exists
This commit is contained in:
parent
b2fd46cd21
commit
4878b85d2f
@ -170,7 +170,7 @@ def make_lines(config):
|
|||||||
|
|
||||||
def truncate_docstring(docstring):
|
def truncate_docstring(docstring):
|
||||||
if not docstring:
|
if not docstring:
|
||||||
return docstring
|
return ''
|
||||||
truncated_docstring = []
|
truncated_docstring = []
|
||||||
for line in docstring.split('\n'):
|
for line in docstring.split('\n'):
|
||||||
if not line.lstrip():
|
if not line.lstrip():
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from magicli.magicli import truncate_docstring
|
|||||||
|
|
||||||
|
|
||||||
def test_no_docstring():
|
def test_no_docstring():
|
||||||
assert truncate_docstring(None) == None
|
assert truncate_docstring(None) == ''
|
||||||
|
|
||||||
def test_padded_multiline_string():
|
def test_padded_multiline_string():
|
||||||
assert truncate_docstring("""This
|
assert truncate_docstring("""This
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user