summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKeewis <keewis@posteo.de>2020-08-06 16:38:49 +0200
committerKeewis <keewis@posteo.de>2020-08-06 16:38:49 +0200
commit75602f290ad14c263d4b8243ab5788a4c33e5d15 (patch)
treeed4abc9a3b48c2b587bae0afdee49cfa698ac915 /tests
parente9f9da532649ee692883ee9ee7ccd7160cd6cfe0 (diff)
downloadsphinx-git-75602f290ad14c263d4b8243ab5788a4c33e5d15.tar.gz
make sure the roles are stripped from invalid names, too
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ext_napoleon_docstring.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py
index 74e54eded..d8ad64b96 100644
--- a/tests/test_ext_napoleon_docstring.py
+++ b/tests/test_ext_napoleon_docstring.py
@@ -1684,6 +1684,20 @@ Example Function
Raises
------
+AnotherError
+ If the dimensions couldn't be parsed.
+
+""", """
+Example Function
+
+:raises ~package.AnotherError: If the dimensions couldn't be parsed.
+"""),
+ ################################
+ ("""
+Example Function
+
+Raises
+------
:class:`exc.InvalidDimensionsError`
:class:`exc.InvalidArgumentsError`
@@ -1694,7 +1708,11 @@ Example Function
:raises exc.InvalidArgumentsError:
""")]
for docstring, expected in docstrings:
- config = Config(napoleon_type_aliases={"CustomError": "package.CustomError"})
+ translations = {
+ "CustomError": "package.CustomError",
+ "AnotherError": ":py:exc:`~package.AnotherError`",
+ }
+ config = Config(napoleon_type_aliases=translations)
app = mock.Mock()
actual = str(NumpyDocstring(docstring, config, app, "method"))
self.assertEqual(expected, actual)