Address feedback

This commit is contained in:
Alex Sergeev 2019-04-13 22:08:18 -10:00
parent 15daf84f1a
commit b7f6657dd1
3 changed files with 25 additions and 1 deletions

View File

@ -993,6 +993,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
# 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
(inspect.isroutine(member) and isinstance(parent, ModuleDocumenter)))

View File

@ -0,0 +1,7 @@
class Cls:
def method(self):
"""Method docstring"""
pass
bound_method = Cls().method

View File

@ -287,7 +287,6 @@ def test_format_signature():
'(b, c=42, *d, **e)'
@pytest.mark.usefixtures('setup_test')
def test_get_doc():
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')
def test_coroutine():
options = {"members": None}