Ensure *args, **kwargs lookthrough works at module scope too

This means that passthrough signatures will be found for top level
functions, which is useful both where they're wrappered by
`functools.wraps` or not.

Fixes https://github.com/davidhalter/jedi/issues/1791.
This commit is contained in:
Peter Law
2021-07-24 16:16:45 +01:00
parent bb40390225
commit 6787719c28
2 changed files with 29 additions and 1 deletions

View File

@@ -292,6 +292,26 @@ def test_pow_signature(Script, environment):
return wrapper
x(f)('''), 'f()'],
[dedent('''
# identifier:C
import functools
def f(x: int, y: float):
pass
@functools.wraps(f)
def wrapper(*args, **kwargs):
return f(*args, **kwargs)
wrapper('''), 'f(x: int, y: float)'],
[dedent('''
# identifier:D
def f(x: int, y: float):
pass
def wrapper(*args, **kwargs):
return f(*args, **kwargs)
wrapper('''), 'wrapper(x: int, y: float)'],
]
)
def test_wraps_signature(Script, code, signature):