diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py index 77de401b..d79992cb 100644 --- a/numpydoc/docscrape.py +++ b/numpydoc/docscrape.py @@ -284,6 +284,8 @@ def _parse_see_also(self, content): """ + content = dedent_lines(content) + items = [] def parse_item_name(text): diff --git a/numpydoc/tests/test_docscrape.py b/numpydoc/tests/test_docscrape.py index 8b297044..2ab0218a 100644 --- a/numpydoc/tests/test_docscrape.py +++ b/numpydoc/tests/test_docscrape.py @@ -17,6 +17,7 @@ ) from numpydoc.docscrape_sphinx import (SphinxDocString, SphinxClassDoc, SphinxFunctionDoc, get_doc_object) +import pytest from pytest import raises as assert_raises from pytest import warns as assert_warns @@ -766,11 +767,16 @@ def test_warns(): assert param.type == 'SomeWarning' assert param.desc == ['If needed'] - -def test_see_also(): +# see numpydoc/numpydoc #281 +# we want to correctly parse "See Also" both in docstrings both like +#"""foo +# and +#""" +#foo +@pytest.mark.parametrize('prefix', ['', '\n ']) +def test_see_also(prefix): doc6 = NumpyDocString( - """ - z(x,theta) + prefix + """z(x,theta) See Also --------