diff options
Diffstat (limited to 'numpydoc/tests/test_docscrape.py')
-rw-r--r-- | numpydoc/tests/test_docscrape.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/numpydoc/tests/test_docscrape.py b/numpydoc/tests/test_docscrape.py index 55ccf92..049d2a2 100644 --- a/numpydoc/tests/test_docscrape.py +++ b/numpydoc/tests/test_docscrape.py @@ -980,6 +980,21 @@ doc8 = NumpyDocString( ) +def test_returns_with_roles_no_names(): + """Make sure colons that are part of sphinx roles are not misinterpreted + as type separator in returns section. See gh-428.""" + docstring = NumpyDocString( + """ + Returns + ------- + str or :class:`NumpyDocString` + """ + ) + expected = "str or :class:`NumpyDocString`" # not "str or : class:... + assert docstring["Returns"][0].type == expected + assert expected in str(docstring) + + def test_trailing_colon(): assert doc8["Parameters"][0].name == "data" |