mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Add a few tests for a previous assertion failure
This commit is contained in:
@@ -47,8 +47,6 @@ def _iter_nodes_for_param(param_name):
|
||||
)
|
||||
for c in values:
|
||||
yield c, args
|
||||
else:
|
||||
assert False
|
||||
|
||||
|
||||
def _goes_to_param_name(param_name, context, potential_name):
|
||||
|
||||
@@ -266,3 +266,25 @@ def test_dataclass_signature(Script, skip_pre_python37, start, start_params):
|
||||
assert quantity.name == 'int'
|
||||
price, = sig.params[-2].infer()
|
||||
assert price.name == 'float'
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'stmt, expected', [
|
||||
('args = 1', 'wrapped(*args, b, c)'),
|
||||
('args = (1,)', 'wrapped(*args, c)'),
|
||||
('kwargs = 1', 'wrapped(b, /, **kwargs)'),
|
||||
('kwargs = dict(b=3)', 'wrapped(b, /, **kwargs)'),
|
||||
]
|
||||
)
|
||||
def test_param_resolving(Script, stmt, expected):
|
||||
code = dedent('''\
|
||||
def full_redirect(func):
|
||||
def wrapped(*args, **kwargs):
|
||||
{stmt}
|
||||
return func(1, *args, **kwargs)
|
||||
return wrapped
|
||||
def simple(a, b, *, c): ...
|
||||
full_redirect(simple)('''.format(stmt=stmt))
|
||||
|
||||
sig, = Script(code).call_signatures()
|
||||
assert sig.to_string() == expected
|
||||
|
||||
Reference in New Issue
Block a user