File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/griffe/_internal/docstrings Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1041,7 +1041,7 @@ def parse_google(
10411041
10421042 offset += 1
10431043
1044- if current_section :
1044+ if current_section and any ( current_section ) :
10451045 sections .append (DocstringSectionText ("\n " .join (current_section ).rstrip ("\n " )))
10461046
10471047 if (
Original file line number Diff line number Diff line change @@ -576,6 +576,17 @@ def test_invalid_sections(parse_google: ParserType) -> None:
576576 assert not warnings
577577
578578
579+ def test_no_empty_text_section (parse_google : ParserType ) -> None :
580+ """Don't create a single empty text section for an empty docstring.
581+
582+ Parameters:
583+ parse_google: Fixture parser.
584+ """
585+ sections , warnings = parse_google ("" )
586+ assert not sections
587+ assert not warnings
588+
589+
579590# =============================================================================================
580591# Parameters sections
581592def test_parse_args_and_kwargs (parse_google : ParserType ) -> None :
You can’t perform that action at this time.
0 commit comments