mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #9384: autodoc_typehints='none' supports typehints for attributes
This commit is contained in:
@@ -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',
|
||||
'',
|
||||
|
||||
Reference in New Issue
Block a user