Make partial use the __doc__ of its function, fixes #1621

This commit is contained in:
Dave Halter
2020-06-25 09:32:48 +02:00
parent 737c1e5792
commit 59ccd2da93
3 changed files with 37 additions and 10 deletions

View File

@@ -422,6 +422,19 @@ def test_decorator(Script):
assert d.docstring(raw=True) == 'Nice docstring'
def test_partial(Script):
code = dedent('''
def foo():
'x y z'
from functools import partial
x = partial(foo)
x''')
p1, p2 = Script(code).infer()
assert p1.docstring(raw=True) == 'x y z'
assert p2.docstring(raw=True) == 'x y z'
def test_basic_str_init_signature(Script, disable_typeshed):
# See GH #1414 and GH #1426
code = dedent('''