mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add `pathlib
types to
_INVALID_BUILTIN_CLASSES
` (#13261)
This commit is contained in:
@@ -696,11 +696,6 @@ def test_mocked_module_imports(app):
|
||||
confoverrides={'autodoc_typehints': 'signature'},
|
||||
)
|
||||
def test_autodoc_typehints_signature(app):
|
||||
if sys.version_info[:2] >= (3, 13):
|
||||
type_ppp = 'pathlib._local.PurePosixPath'
|
||||
else:
|
||||
type_ppp = 'pathlib.PurePosixPath'
|
||||
|
||||
options = {
|
||||
'members': None,
|
||||
'undoc-members': None,
|
||||
@@ -726,7 +721,7 @@ def test_autodoc_typehints_signature(app):
|
||||
'',
|
||||
'.. py:data:: CONST3',
|
||||
' :module: target.typehints',
|
||||
f' :type: ~{type_ppp}',
|
||||
' :type: ~pathlib.PurePosixPath',
|
||||
" :value: PurePosixPath('/a/b/c')",
|
||||
'',
|
||||
' docstring',
|
||||
@@ -749,7 +744,7 @@ def test_autodoc_typehints_signature(app):
|
||||
'',
|
||||
' .. py:attribute:: Math.CONST3',
|
||||
' :module: target.typehints',
|
||||
f' :type: ~{type_ppp}',
|
||||
' :type: ~pathlib.PurePosixPath',
|
||||
" :value: PurePosixPath('/a/b/c')",
|
||||
'',
|
||||
'',
|
||||
@@ -771,7 +766,7 @@ def test_autodoc_typehints_signature(app):
|
||||
'',
|
||||
' .. py:property:: Math.path',
|
||||
' :module: target.typehints',
|
||||
f' :type: ~{type_ppp}',
|
||||
' :type: ~pathlib.PurePosixPath',
|
||||
'',
|
||||
'',
|
||||
' .. py:property:: Math.prop',
|
||||
@@ -796,7 +791,7 @@ def test_autodoc_typehints_signature(app):
|
||||
'',
|
||||
' docstring',
|
||||
'',
|
||||
f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
|
||||
" alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
|
||||
'',
|
||||
'',
|
||||
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
|
||||
@@ -828,10 +823,6 @@ def test_autodoc_typehints_signature(app):
|
||||
confoverrides={'autodoc_typehints': 'none'},
|
||||
)
|
||||
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,
|
||||
'undoc-members': None,
|
||||
@@ -919,7 +910,7 @@ def test_autodoc_typehints_none(app):
|
||||
'',
|
||||
' docstring',
|
||||
'',
|
||||
f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
|
||||
" alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
|
||||
'',
|
||||
'',
|
||||
'.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)',
|
||||
@@ -1511,10 +1502,6 @@ def test_autodoc_typehints_description_and_type_aliases(app):
|
||||
confoverrides={'autodoc_typehints_format': 'fully-qualified'},
|
||||
)
|
||||
def test_autodoc_typehints_format_fully_qualified(app):
|
||||
if sys.version_info[:2] >= (3, 13):
|
||||
type_ppp = 'pathlib._local.PurePosixPath'
|
||||
else:
|
||||
type_ppp = 'pathlib.PurePosixPath'
|
||||
options = {
|
||||
'members': None,
|
||||
'undoc-members': None,
|
||||
@@ -1540,7 +1527,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
||||
'',
|
||||
'.. py:data:: CONST3',
|
||||
' :module: target.typehints',
|
||||
f' :type: {type_ppp}',
|
||||
' :type: pathlib.PurePosixPath',
|
||||
" :value: PurePosixPath('/a/b/c')",
|
||||
'',
|
||||
' docstring',
|
||||
@@ -1563,7 +1550,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
||||
'',
|
||||
' .. py:attribute:: Math.CONST3',
|
||||
' :module: target.typehints',
|
||||
f' :type: {type_ppp}',
|
||||
' :type: pathlib.PurePosixPath',
|
||||
" :value: PurePosixPath('/a/b/c')",
|
||||
'',
|
||||
'',
|
||||
@@ -1585,7 +1572,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
||||
'',
|
||||
' .. py:property:: Math.path',
|
||||
' :module: target.typehints',
|
||||
f' :type: {type_ppp}',
|
||||
' :type: pathlib.PurePosixPath',
|
||||
'',
|
||||
'',
|
||||
' .. py:property:: Math.prop',
|
||||
@@ -1610,7 +1597,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
|
||||
'',
|
||||
' docstring',
|
||||
'',
|
||||
f" alias of TypeVar('T', bound=\\ :py:class:`{type_ppp}`)",
|
||||
" alias of TypeVar('T', bound=\\ :py:class:`pathlib.PurePosixPath`)",
|
||||
'',
|
||||
'',
|
||||
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
|
||||
|
Reference in New Issue
Block a user