summaryrefslogtreecommitdiff
path: root/tests/test_ext_autodoc.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-09-14 23:39:47 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-09-14 23:59:47 +0900
commited227d7d3c1e9d386b58bacfd7d379fff380db4a (patch)
tree88518d3194e885d9fd5f494ffbbe6a534b360fbc /tests/test_ext_autodoc.py
parentba2439a105e5a68a44dd3f839e86332889cce451 (diff)
downloadsphinx-git-ed227d7d3c1e9d386b58bacfd7d379fff380db4a.tar.gz
Fix #9630: autodoc: Failed to build xrefs if primary_domain is not 'py'
Autodoc generates reST code that uses raw `:obj:` and `:class:` xrefs to refer the classes and types. But they're fragile because they assume the primary_domain=='py'. This adds `:py:` prefix to these xrefs to make them robust.
Diffstat (limited to 'tests/test_ext_autodoc.py')
-rw-r--r--tests/test_ext_autodoc.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py
index 299c1c681..155842007 100644
--- a/tests/test_ext_autodoc.py
+++ b/tests/test_ext_autodoc.py
@@ -984,7 +984,7 @@ def test_autodoc_inner_class(app):
' .. py:attribute:: Outer.factory',
' :module: target',
'',
- ' alias of :class:`dict`'
+ ' alias of :py:class:`dict`'
]
actual = do_autodoc(app, 'class', 'target.Outer.Inner', options)
@@ -1009,7 +1009,7 @@ def test_autodoc_inner_class(app):
'',
'.. py:class:: InnerChild()',
' :module: target', '',
- ' Bases: :class:`target.Outer.Inner`',
+ ' Bases: :py:class:`target.Outer.Inner`',
'',
' InnerChild docstring',
'',
@@ -1750,7 +1750,7 @@ def test_autodoc_typed_instance_variables(app):
'.. py:attribute:: Alias',
' :module: target.typed_vars',
'',
- ' alias of :class:`target.typed_vars.Derived`',
+ ' alias of :py:class:`target.typed_vars.Derived`',
'',
'.. py:class:: Class()',
' :module: target.typed_vars',
@@ -1915,12 +1915,12 @@ def test_autodoc_GenericAlias(app):
' .. py:attribute:: Class.T',
' :module: target.genericalias',
'',
- ' alias of :class:`~typing.List`\\ [:class:`int`]',
+ ' alias of :py:class:`~typing.List`\\ [:py:class:`int`]',
'',
'.. py:attribute:: T',
' :module: target.genericalias',
'',
- ' alias of :class:`~typing.List`\\ [:class:`int`]',
+ ' alias of :py:class:`~typing.List`\\ [:py:class:`int`]',
]
else:
assert list(actual) == [
@@ -1937,7 +1937,7 @@ def test_autodoc_GenericAlias(app):
'',
' A list of int',
'',
- ' alias of :class:`~typing.List`\\ [:class:`int`]',
+ ' alias of :py:class:`~typing.List`\\ [:py:class:`int`]',
'',
'',
'.. py:data:: T',
@@ -1945,7 +1945,7 @@ def test_autodoc_GenericAlias(app):
'',
' A list of int',
'',
- ' alias of :class:`~typing.List`\\ [:class:`int`]',
+ ' alias of :py:class:`~typing.List`\\ [:py:class:`int`]',
'',
]
@@ -1977,7 +1977,7 @@ def test_autodoc_TypeVar(app):
'',
' T6',
'',
- ' alias of :class:`int`',
+ ' alias of :py:class:`int`',
'',
'',
'.. py:data:: T1',
@@ -2017,7 +2017,7 @@ def test_autodoc_TypeVar(app):
'',
' T6',
'',
- ' alias of :class:`int`',
+ ' alias of :py:class:`int`',
'',
'',
'.. py:data:: T7',
@@ -2025,7 +2025,7 @@ def test_autodoc_TypeVar(app):
'',
' T7',
'',
- " alias of TypeVar('T7', bound=\\ :class:`int`)",
+ " alias of TypeVar('T7', bound=\\ :py:class:`int`)",
'',
]