Fix #9757: autodoc_inherit_docstrings does not effect to overriden classmethods

This commit is contained in:
Takeshi KOMIYA
2021-10-30 02:01:38 +09:00
parent 4c91c038b2
commit 3c5b31b50d
3 changed files with 24 additions and 1 deletions

View File

@@ -677,6 +677,25 @@ def test_unpartial():
assert inspect.unpartial(func3) is func1
def test_getdoc_inherited_classmethod():
class Foo:
@classmethod
def meth(self):
"""
docstring
indented text
"""
class Bar(Foo):
@classmethod
def meth(self):
# inherited classmethod
pass
assert inspect.getdoc(Bar.meth, getattr, False, Bar, "meth") is None
assert inspect.getdoc(Bar.meth, getattr, True, Bar, "meth") == Foo.meth.__doc__
def test_getdoc_inherited_decorated_method():
class Foo:
def meth(self):