diff options
| author | Rob Ruana <rob@robruana.com> | 2015-05-27 10:57:04 -0700 |
|---|---|---|
| committer | Rob Ruana <rob@robruana.com> | 2015-05-27 10:58:26 -0700 |
| commit | 048f54f2b0e448712c3d97fad14628d094afc67c (patch) | |
| tree | f79ce4d4ac1302057080c5fed9a32fefe74243eb /tests/test_ext_napoleon_docstring.py | |
| parent | 2710d8e5b2dadce9ea4b5cc098ad6e34dc868029 (diff) | |
| download | sphinx-git-048f54f2b0e448712c3d97fad14628d094afc67c.tar.gz | |
Closes #1904: [Napoleon] parses restructuredtext references in fields/params BEFORE splitting on colon
Diffstat (limited to 'tests/test_ext_napoleon_docstring.py')
| -rw-r--r-- | tests/test_ext_napoleon_docstring.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py index bfd067ade..5cb5f1627 100644 --- a/tests/test_ext_napoleon_docstring.py +++ b/tests/test_ext_napoleon_docstring.py @@ -360,6 +360,22 @@ Returns: actual = str(GoogleDocstring(docstring)) self.assertEqual(expected, actual) + def test_xrefs_in_return_type(self): + docstring = """Example Function + +Returns: + :class:`numpy.ndarray`: A :math:`n \\times 2` array containing + a bunch of math items +""" + expected = """Example Function + +:returns: A :math:`n \\times 2` array containing + a bunch of math items +:rtype: :class:`numpy.ndarray` +""" + actual = str(GoogleDocstring(docstring)) + self.assertEqual(expected, actual) + def test_kwargs_in_arguments(self): docstring = """Allows to create attributes binded to this device. @@ -696,3 +712,25 @@ arg_ : type actual = str(NumpyDocstring(docstring, config, app, "class")) self.assertEqual(expected, actual) + + def test_xrefs_in_return_type(self): + docstring = """ +Example Function + +Returns +------- +:class:`numpy.ndarray` + A :math:`n \\times 2` array containing + a bunch of math items +""" + expected = """ +Example Function + +:returns: A :math:`n \\times 2` array containing + a bunch of math items +:rtype: :class:`numpy.ndarray` +""" + config = Config() + app = mock.Mock() + actual = str(NumpyDocstring(docstring, config, app, "method")) + self.assertEqual(expected, actual) |
