mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
add testcase for complex typehintsext.autodoc.typehints
This commit is contained in:
parent
4877a7594c
commit
db72c18cf9
@ -9,3 +9,5 @@
|
||||
:members:
|
||||
|
||||
.. autofunction:: target.typehints.incr
|
||||
|
||||
.. autofunction:: target.typehints.tuple_args
|
||||
|
@ -1,3 +1,6 @@
|
||||
from typing import Tuple, Union
|
||||
|
||||
|
||||
def incr(a: int, b: int = 1) -> int:
|
||||
return a + b
|
||||
|
||||
@ -30,6 +33,10 @@ class Math:
|
||||
return
|
||||
|
||||
|
||||
def tuple_args(x: Tuple[int, Union[int, str]]) -> Tuple[int, int]:
|
||||
pass
|
||||
|
||||
|
||||
def complex_func(arg1, arg2, arg3=None, *args, **kwargs):
|
||||
# type: (str, List[int], Tuple[int, Union[str, Unknown]], *str, **str) -> None
|
||||
pass
|
||||
|
@ -508,7 +508,11 @@ def test_autodoc_typehints_signature(app):
|
||||
'',
|
||||
'.. py:function:: missing_attr(c, a: str, b: Optional[str] = None) -> str',
|
||||
' :module: target.typehints',
|
||||
''
|
||||
'',
|
||||
'',
|
||||
'.. py:function:: tuple_args(x: Tuple[int, Union[int, str]]) -> Tuple[int, int]',
|
||||
' :module: target.typehints',
|
||||
'',
|
||||
]
|
||||
|
||||
|
||||
@ -557,7 +561,11 @@ def test_autodoc_typehints_none(app):
|
||||
'',
|
||||
'.. py:function:: missing_attr(c, a, b=None)',
|
||||
' :module: target.typehints',
|
||||
''
|
||||
'',
|
||||
'',
|
||||
'.. py:function:: tuple_args(x)',
|
||||
' :module: target.typehints',
|
||||
'',
|
||||
]
|
||||
|
||||
|
||||
@ -576,6 +584,15 @@ def test_autodoc_typehints_description(app):
|
||||
' Return type:\n'
|
||||
' int\n'
|
||||
in context)
|
||||
assert ('target.typehints.tuple_args(x)\n'
|
||||
'\n'
|
||||
' Parameters:\n'
|
||||
' **x** (*Tuple**[**int**, **Union**[**int**, **str**]**]*) --\n'
|
||||
'\n'
|
||||
' Return type:\n'
|
||||
' Tuple[int, int]\n'
|
||||
in context)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||
|
Loading…
Reference in New Issue
Block a user