mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
fix the tests by falling back to a empty dict on AttributeError
This commit is contained in:
parent
d9fb3bc25c
commit
e697242451
@ -1131,7 +1131,11 @@ class NumpyDocstring(GoogleDocstring):
|
||||
func_name1, func_name2, :meth:`func_name`, func_name3
|
||||
|
||||
"""
|
||||
inventory = getattr(self._app.builder.env, "intersphinx_inventory", {})
|
||||
try:
|
||||
inventory = self._app.builder.env.intersphinx_inventory
|
||||
except AttributeError:
|
||||
inventory = {}
|
||||
|
||||
items = []
|
||||
|
||||
def parse_item_name(text: str) -> Tuple[str, str]:
|
||||
|
@ -1365,6 +1365,7 @@ otherfunc : relationship
|
||||
|
||||
config = Config()
|
||||
app = mock.Mock()
|
||||
app.builder.env = None
|
||||
actual = str(NumpyDocstring(docstring, config, app, "method"))
|
||||
|
||||
expected = """\
|
||||
@ -1379,6 +1380,27 @@ numpy.multivariate_normal(mean, cov, shape=None, spam=None)
|
||||
"""
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
config = Config()
|
||||
app = mock.Mock()
|
||||
app.builder.env.intersphinx_inventory = {
|
||||
"py:func": {"funcs": (), "otherfunc": ()},
|
||||
"py:meth": {"some": (), "other": ()},
|
||||
}
|
||||
actual = str(NumpyDocstring(docstring, config, app, "method"))
|
||||
|
||||
expected = """\
|
||||
numpy.multivariate_normal(mean, cov, shape=None, spam=None)
|
||||
|
||||
.. seealso::
|
||||
|
||||
:meth:`some`, :meth:`other`, :func:`funcs`
|
||||
\n\
|
||||
:func:`otherfunc`
|
||||
relationship
|
||||
"""
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
|
||||
def test_colon_in_return_type(self):
|
||||
docstring = """
|
||||
Summary
|
||||
|
Loading…
Reference in New Issue
Block a user