Fix #9384: autodoc_typehints='none' supports typehints for attributes

This commit is contained in:
Takeshi KOMIYA
2021-06-29 21:48:19 +09:00
parent b187ca0951
commit 2aef00d7bd
4 changed files with 65 additions and 11 deletions

View File

@@ -554,10 +554,26 @@ def test_autodoc_typehints_signature(app):
'.. py:module:: target.typehints',
'',
'',
'.. py:data:: CONST1',
' :module: target.typehints',
' :type: int',
'',
'',
'.. py:class:: Math(s: str, o: Optional[Any] = None)',
' :module: target.typehints',
'',
'',
' .. py:attribute:: Math.CONST1',
' :module: target.typehints',
' :type: int',
'',
'',
' .. py:attribute:: Math.CONST2',
' :module: target.typehints',
' :type: int',
' :value: 1',
'',
'',
' .. py:method:: Math.decr(a: int, b: int = 1) -> int',
' :module: target.typehints',
'',
@@ -574,6 +590,11 @@ def test_autodoc_typehints_signature(app):
' :module: target.typehints',
'',
'',
' .. py:property:: Math.prop',
' :module: target.typehints',
' :type: int',
'',
'',
'.. py:class:: NewAnnotation(i: int)',
' :module: target.typehints',
'',
@@ -620,10 +641,23 @@ def test_autodoc_typehints_none(app):
'.. py:module:: target.typehints',
'',
'',
'.. py:data:: CONST1',
' :module: target.typehints',
'',
'',
'.. py:class:: Math(s, o=None)',
' :module: target.typehints',
'',
'',
' .. py:attribute:: Math.CONST1',
' :module: target.typehints',
'',
'',
' .. py:attribute:: Math.CONST2',
' :module: target.typehints',
' :value: 1',
'',
'',
' .. py:method:: Math.decr(a, b=1)',
' :module: target.typehints',
'',
@@ -640,6 +674,10 @@ def test_autodoc_typehints_none(app):
' :module: target.typehints',
'',
'',
' .. py:property:: Math.prop',
' :module: target.typehints',
'',
'',
'.. py:class:: NewAnnotation(i)',
' :module: target.typehints',
'',