mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Address feedback
This commit is contained in:
parent
15daf84f1a
commit
b7f6657dd1
@ -993,6 +993,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
|
|||||||
@classmethod
|
@classmethod
|
||||||
def can_document_member(cls, member, membername, isattr, parent):
|
def can_document_member(cls, member, membername, isattr, parent):
|
||||||
# type: (Any, str, bool, Any) -> bool
|
# type: (Any, str, bool, Any) -> bool
|
||||||
|
# supports functions, builtins and bound methods exported at the module level
|
||||||
return (inspect.isfunction(member) or inspect.isbuiltin(member) or
|
return (inspect.isfunction(member) or inspect.isbuiltin(member) or
|
||||||
(inspect.isroutine(member) and isinstance(parent, ModuleDocumenter)))
|
(inspect.isroutine(member) and isinstance(parent, ModuleDocumenter)))
|
||||||
|
|
||||||
|
7
tests/roots/test-ext-autodoc/target/bound_method.py
Normal file
7
tests/roots/test-ext-autodoc/target/bound_method.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class Cls:
|
||||||
|
def method(self):
|
||||||
|
"""Method docstring"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
bound_method = Cls().method
|
@ -287,7 +287,6 @@ def test_format_signature():
|
|||||||
'(b, c=42, *d, **e)'
|
'(b, c=42, *d, **e)'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures('setup_test')
|
@pytest.mark.usefixtures('setup_test')
|
||||||
def test_get_doc():
|
def test_get_doc():
|
||||||
def getdocl(objtype, obj):
|
def getdocl(objtype, obj):
|
||||||
@ -1477,6 +1476,23 @@ def test_partialfunction():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures('setup_test')
|
||||||
|
def test_bound_method():
|
||||||
|
options = {"members": None}
|
||||||
|
actual = do_autodoc(app, 'module', 'target.bound_method', options)
|
||||||
|
assert list(actual) == [
|
||||||
|
'',
|
||||||
|
'.. py:module:: target.bound_method',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'.. py:function:: bound_method()',
|
||||||
|
' :module: target.bound_method',
|
||||||
|
'',
|
||||||
|
' Method docstring',
|
||||||
|
' ',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures('setup_test')
|
@pytest.mark.usefixtures('setup_test')
|
||||||
def test_coroutine():
|
def test_coroutine():
|
||||||
options = {"members": None}
|
options = {"members": None}
|
||||||
|
Loading…
Reference in New Issue
Block a user