summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKeewis <keewis@posteo.de>2020-08-06 14:08:34 +0200
committerKeewis <keewis@posteo.de>2020-08-06 14:08:34 +0200
commit4428393403ad98e49459e36085c7f0a85a627bab (patch)
treefd873eff154a22ead1e5984f340b163b13cffb50 /tests
parentca0bd28681afd72c826603eeef5a3ec8fac4e8dd (diff)
downloadsphinx-git-4428393403ad98e49459e36085c7f0a85a627bab.tar.gz
translate the functions before attempting to find a matching role
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ext_napoleon_docstring.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py
index 0894a9bff..57bdf1342 100644
--- a/tests/test_ext_napoleon_docstring.py
+++ b/tests/test_ext_napoleon_docstring.py
@@ -1400,6 +1400,38 @@ numpy.multivariate_normal(mean, cov, shape=None, spam=None)
"""
self.assertEqual(expected, actual)
+ docstring = """\
+numpy.multivariate_normal(mean, cov, shape=None, spam=None)
+
+See Also
+--------
+some, other, :func:`funcs`
+otherfunc : relationship
+
+"""
+ translations = {
+ "other": "MyClass.other",
+ "otherfunc": ":func:`~my_package.otherfunc`",
+ }
+ config = Config(napoleon_type_aliases=translations)
+ app = mock.Mock()
+ app.builder.env.intersphinx_inventory = {
+ "py:func": {"funcs": (), "otherfunc": ()},
+ "py:meth": {"some": (), "MyClass.other": ()},
+ }
+ actual = str(NumpyDocstring(docstring, config, app, "method"))
+
+ expected = """\
+numpy.multivariate_normal(mean, cov, shape=None, spam=None)
+
+.. seealso::
+
+ :meth:`some`, :meth:`MyClass.other`, :func:`funcs`
+ \n\
+ :func:`~my_package.otherfunc`
+ relationship
+"""
+ self.assertEqual(expected, actual)
def test_colon_in_return_type(self):
docstring = """