mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
🧪 Fix python 3.13 tests (#12373)
This commit is contained in:
parent
c06f246124
commit
3496de62b7
@ -838,7 +838,7 @@ def test_autodoc_special_members(app):
|
|||||||
"special-members": None,
|
"special-members": None,
|
||||||
}
|
}
|
||||||
if sys.version_info >= (3, 13, 0, 'alpha', 5):
|
if sys.version_info >= (3, 13, 0, 'alpha', 5):
|
||||||
options["exclude-members"] = "__static_attributes__"
|
options["exclude-members"] = "__static_attributes__,__firstlineno__"
|
||||||
actual = do_autodoc(app, 'class', 'target.Class', options)
|
actual = do_autodoc(app, 'class', 'target.Class', options)
|
||||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||||
'.. py:class:: Class(arg)',
|
'.. py:class:: Class(arg)',
|
||||||
|
@ -679,6 +679,10 @@ def test_autodoc_typehints_signature(app):
|
|||||||
type_o = "~typing.Any | None"
|
type_o = "~typing.Any | None"
|
||||||
else:
|
else:
|
||||||
type_o = "~typing.Any"
|
type_o = "~typing.Any"
|
||||||
|
if sys.version_info[:2] >= (3, 13):
|
||||||
|
type_ppp = "pathlib._local.PurePosixPath"
|
||||||
|
else:
|
||||||
|
type_ppp = "pathlib.PurePosixPath"
|
||||||
|
|
||||||
options = {"members": None,
|
options = {"members": None,
|
||||||
"undoc-members": None}
|
"undoc-members": None}
|
||||||
@ -703,7 +707,7 @@ def test_autodoc_typehints_signature(app):
|
|||||||
'',
|
'',
|
||||||
'.. py:data:: CONST3',
|
'.. py:data:: CONST3',
|
||||||
' :module: target.typehints',
|
' :module: target.typehints',
|
||||||
' :type: ~pathlib.PurePosixPath',
|
f' :type: ~{type_ppp}',
|
||||||
" :value: PurePosixPath('/a/b/c')",
|
" :value: PurePosixPath('/a/b/c')",
|
||||||
'',
|
'',
|
||||||
' docstring',
|
' docstring',
|
||||||
@ -726,7 +730,7 @@ def test_autodoc_typehints_signature(app):
|
|||||||
'',
|
'',
|
||||||
' .. py:attribute:: Math.CONST3',
|
' .. py:attribute:: Math.CONST3',
|
||||||
' :module: target.typehints',
|
' :module: target.typehints',
|
||||||
' :type: ~pathlib.PurePosixPath',
|
f' :type: ~{type_ppp}',
|
||||||
" :value: PurePosixPath('/a/b/c')",
|
" :value: PurePosixPath('/a/b/c')",
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@ -748,7 +752,7 @@ def test_autodoc_typehints_signature(app):
|
|||||||
'',
|
'',
|
||||||
' .. py:property:: Math.path',
|
' .. py:property:: Math.path',
|
||||||
' :module: target.typehints',
|
' :module: target.typehints',
|
||||||
' :type: ~pathlib.PurePosixPath',
|
f' :type: ~{type_ppp}',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
' .. py:property:: Math.prop',
|
' .. py:property:: Math.prop',
|
||||||
@ -773,7 +777,7 @@ def test_autodoc_typehints_signature(app):
|
|||||||
'',
|
'',
|
||||||
' docstring',
|
' docstring',
|
||||||
'',
|
'',
|
||||||
" alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
|
f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
|
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
|
||||||
@ -802,6 +806,10 @@ def test_autodoc_typehints_signature(app):
|
|||||||
@pytest.mark.sphinx('html', testroot='ext-autodoc',
|
@pytest.mark.sphinx('html', testroot='ext-autodoc',
|
||||||
confoverrides={'autodoc_typehints': "none"})
|
confoverrides={'autodoc_typehints': "none"})
|
||||||
def test_autodoc_typehints_none(app):
|
def test_autodoc_typehints_none(app):
|
||||||
|
if sys.version_info[:2] >= (3, 13):
|
||||||
|
type_ppp = "pathlib._local.PurePosixPath"
|
||||||
|
else:
|
||||||
|
type_ppp = "pathlib.PurePosixPath"
|
||||||
options = {"members": None,
|
options = {"members": None,
|
||||||
"undoc-members": None}
|
"undoc-members": None}
|
||||||
actual = do_autodoc(app, 'module', 'target.typehints', options)
|
actual = do_autodoc(app, 'module', 'target.typehints', options)
|
||||||
@ -887,7 +895,7 @@ def test_autodoc_typehints_none(app):
|
|||||||
'',
|
'',
|
||||||
' docstring',
|
' docstring',
|
||||||
'',
|
'',
|
||||||
" alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
|
f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)',
|
'.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)',
|
||||||
@ -1417,7 +1425,10 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
|||||||
type_o = "typing.Any | None"
|
type_o = "typing.Any | None"
|
||||||
else:
|
else:
|
||||||
type_o = "typing.Any"
|
type_o = "typing.Any"
|
||||||
|
if sys.version_info[:2] >= (3, 13):
|
||||||
|
type_ppp = "pathlib._local.PurePosixPath"
|
||||||
|
else:
|
||||||
|
type_ppp = "pathlib.PurePosixPath"
|
||||||
options = {"members": None,
|
options = {"members": None,
|
||||||
"undoc-members": None}
|
"undoc-members": None}
|
||||||
actual = do_autodoc(app, 'module', 'target.typehints', options)
|
actual = do_autodoc(app, 'module', 'target.typehints', options)
|
||||||
@ -1441,7 +1452,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
|||||||
'',
|
'',
|
||||||
'.. py:data:: CONST3',
|
'.. py:data:: CONST3',
|
||||||
' :module: target.typehints',
|
' :module: target.typehints',
|
||||||
' :type: pathlib.PurePosixPath',
|
f' :type: {type_ppp}',
|
||||||
" :value: PurePosixPath('/a/b/c')",
|
" :value: PurePosixPath('/a/b/c')",
|
||||||
'',
|
'',
|
||||||
' docstring',
|
' docstring',
|
||||||
@ -1464,7 +1475,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
|||||||
'',
|
'',
|
||||||
' .. py:attribute:: Math.CONST3',
|
' .. py:attribute:: Math.CONST3',
|
||||||
' :module: target.typehints',
|
' :module: target.typehints',
|
||||||
' :type: pathlib.PurePosixPath',
|
f' :type: {type_ppp}',
|
||||||
" :value: PurePosixPath('/a/b/c')",
|
" :value: PurePosixPath('/a/b/c')",
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@ -1486,7 +1497,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
|||||||
'',
|
'',
|
||||||
' .. py:property:: Math.path',
|
' .. py:property:: Math.path',
|
||||||
' :module: target.typehints',
|
' :module: target.typehints',
|
||||||
' :type: pathlib.PurePosixPath',
|
f' :type: {type_ppp}',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
' .. py:property:: Math.prop',
|
' .. py:property:: Math.prop',
|
||||||
@ -1511,7 +1522,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
|||||||
'',
|
'',
|
||||||
' docstring',
|
' docstring',
|
||||||
'',
|
'',
|
||||||
" alias of TypeVar('T', bound=\\ :py:class:`pathlib.PurePosixPath`)",
|
f" alias of TypeVar('T', bound=\\ :py:class:`{type_ppp}`)",
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
|
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
|
||||||
|
Loading…
Reference in New Issue
Block a user