Skip to content

Commit

Permalink
fix error with inferring description from empty docstring (#7788)
Browse files Browse the repository at this point in the history
  • Loading branch information
sryza committed May 9, 2022
1 parent 8e05a7d commit 1b08360
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python_modules/dagster/dagster/core/decorator_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def param_is_var_keyword(param: funcsigs.Parameter) -> bool:
def format_docstring_for_description(fn: Callable) -> Optional[str]:
if fn.__doc__ is not None:
docstring = fn.__doc__
if docstring[0].isspace():
if len(docstring) > 0 and docstring[0].isspace():
return textwrap.dedent(docstring).strip()
else:
first_newline_pos = docstring.find("\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ def no_indentation_at_start():
format_docstring_for_description(no_indentation_at_start)
== no_indentation_at_start_expected
)


def test_empty():
def empty_docstring():
""""""

assert format_docstring_for_description(empty_docstring) == ""

0 comments on commit 1b08360

Please sign in to comment.