Repository: numpy/numpydoc

Issue:
Failed See Also Parsing.
```
In [1]: from numpydoc.docscrape import NumpyDocString
   ...: from numpy import seterrobj
   ...: NumpyDocString("""seterrobj(errobj)
   ...:
   ...:     Set the object that defines floating-point error handling.
   ...:
   ...:     See Also
   ...:     --------
   ...:     geterrobj, seterr, geterr, seterrcall, geterrcall
   ...:     getbufsize, setbufsize""")['See Also']
Out[1]: []

In [2]:
```

```
diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py
index 77de401..d79992c 100644
--- a/numpydoc/docscrape.py
+++ b/numpydoc/docscrape.py
@@ -284,6 +284,8 @@ class NumpyDocString(Mapping):

         """

+        content = dedent_lines(content)
         items = []

         def parse_item_name(text):
```

Might be enough, but it may also be the wrong place to put that:

```
In [1]: from numpydoc.docscrape import NumpyDocString
   ...: from numpy import seterrobj
   ...: NumpyDocString("""seterrobj(errobj)
   ...:
   ...:     Set the object that defines floating-point error handling.
   ...:
   ...:     See Also
   ...:     --------
   ...:     geterrobj, seterr, geterr, seterrcall, geterrcall
   ...:     getbufsize, setbufsize""")['See Also']
Out[1]:
[([('geterrobj', None),
   ('seterr', None),
   ('geterr', None),
   ('seterrcall', None),
   ('geterrcall', None)],
  []),
 ([('getbufsize', None), ('setbufsize', None)], [])]
```




Discussion:

Patch:
diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py
index 77de401..d79992c 100644
--- a/numpydoc/docscrape.py
+++ b/numpydoc/docscrape.py
@@ -284,6 +284,8 @@ class NumpyDocString(Mapping):
 
         """
 
+        content = dedent_lines(content)
+
         items = []
 
         def parse_item_name(text):


Test patch:
diff --git a/numpydoc/tests/test_docscrape.py b/numpydoc/tests/test_docscrape.py
index 8b29704..2ab0218 100644
--- a/numpydoc/tests/test_docscrape.py
+++ b/numpydoc/tests/test_docscrape.py
@@ -17,6 +17,7 @@ from numpydoc.docscrape import (
 )
 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
     --------