File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ def _read_block_items(
129129
130130 if line .startswith (4 * " " ):
131131 # continuation line
132- current_item .append (line . lstrip () )
132+ current_item .append (line [ 4 :] )
133133 previous_was_empty = False
134134
135135 elif line .startswith (" " ):
Original file line number Diff line number Diff line change @@ -114,6 +114,19 @@ def test_empty_indented_lines_in_section_with_items(parse_numpy: ParserType) ->
114114 assert len (sections2 [0 ].value ) == 2
115115
116116
117+ def test_doubly_indented_lines_in_section_items (parse_numpy : ParserType ) -> None :
118+ """In sections with items, don't remove all spaces on the left of indented lines.
119+
120+ Parameters:
121+ parse_numpy: Fixture parser.
122+ """
123+ docstring = "Returns\n -------\n only_item : type\n Description:\n \n - List item.\n - Sublist item."
124+ sections , _ = parse_numpy (docstring )
125+ assert len (sections ) == 1
126+ lines = sections [0 ].value [0 ].description .split ("\n " )
127+ assert lines [- 1 ].startswith (4 * " " + "- " )
128+
129+
117130# =============================================================================================
118131# Annotations
119132def test_prefer_docstring_type_over_annotation (parse_numpy : ParserType ) -> None :
You can’t perform that action at this time.
0 commit comments