mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #9752: autodoc: Failed to detect type annotation for slots attribute
This commit is contained in:
@@ -10,6 +10,7 @@ class Bar:
|
||||
__slots__ = {'attr1': 'docstring of attr1',
|
||||
'attr2': 'docstring of attr2',
|
||||
'attr3': None}
|
||||
__annotations__ = {'attr1': int}
|
||||
|
||||
def __init__(self):
|
||||
self.attr2 = None #: docstring of instance attr2
|
||||
|
||||
@@ -1359,6 +1359,7 @@ def test_slots(app):
|
||||
'',
|
||||
' .. py:attribute:: Bar.attr1',
|
||||
' :module: target.slots',
|
||||
' :type: int',
|
||||
'',
|
||||
' docstring of attr1',
|
||||
'',
|
||||
|
||||
@@ -129,6 +129,7 @@ def test_autoattribute_slots_variable_dict(app):
|
||||
'',
|
||||
'.. py:attribute:: Bar.attr1',
|
||||
' :module: target.slots',
|
||||
' :type: int',
|
||||
'',
|
||||
' docstring of attr1',
|
||||
'',
|
||||
|
||||
@@ -243,6 +243,7 @@ def test_slots_attribute(app):
|
||||
'',
|
||||
' .. py:attribute:: Bar.attr1',
|
||||
' :module: target.slots',
|
||||
' :type: int',
|
||||
'',
|
||||
' docstring of attr1',
|
||||
'',
|
||||
|
||||
Reference in New Issue
Block a user