Fix tests

This commit is contained in:
Dave Halter committed 2026-10-13 12:23:01 +02:00
1 parent 3fd1c87716
commit 2af1a0f394
2 files changed
+17 -14

No files matched your search

+13 -10
View File
@@ -94,8 +94,20 @@ def _remove_given_params(arguments, param_names):
yield p
class ParamNameFixedKind(ParamNameWrapper):
def __init__(self, param_name, new_kind):
super().__init__(param_name)
self._new_kind = new_kind
def get_kind(self):
return self._new_kind
@to_list
def process_params(param_names: Sequence[AnonymousParamName | ParamNameFixedKind], star_count=3, already_used=None):
def process_params(
param_names: Sequence[AnonymousParamName | ParamNameFixedKind],
star_count=3,
already_used=None):
# start_count=3 means both * and **
if already_used is None:
already_used = set()
@@ -219,12 +231,3 @@ def process_params(param_names: Sequence[AnonymousParamName | ParamNameFixedKind
yield original_kwarg_name
elif kwarg_names:
yield kwarg_names[0]
class ParamNameFixedKind(ParamNameWrapper):
def __init__(self, param_name, new_kind):
super().__init__(param_name)
self._new_kind = new_kind
def get_kind(self):
return self._new_kind
+4 -4
View File
@@ -165,7 +165,7 @@ def test_tree_signature(Script, environment, code, expected):
('two_kwargs_redirects(kw, kw)', '*args, a, b, c, **kwargs'),
('two_kwargs_redirects(simple, kw)', '*args, a, b, c, **kwargs'),
('two_kwargs_redirects(simple2, two_kwargs_redirects(simple, simple))',
'*args, x, a, b, c'),
'*args, x, **kwargs'),
('combined_redirect(simple, simple2)', 'a, b, /, *, x'),
('combined_redirect(simple, simple3)', 'a, b, /, *, a, x: int'),
@@ -180,11 +180,11 @@ def test_tree_signature(Script, environment, code, expected):
('combined_lot_of_args(simple4, kw)', '*, b, c, **kwargs'),
('combined_redirect(combined_redirect(simple2, simple4), combined_redirect(kw, simple5))',
'x, /, *, y'),
'*args, **kwargs'),
('combined_redirect(combined_redirect(simple4, simple2), combined_redirect(simple5, kw))',
'a, b, x: int, /, *, a, b, c, **kwargs'),
'*args, **kwargs'),
('combined_redirect(combined_redirect(a, kw), combined_redirect(kw, simple5))',
'a, b, /, *args, y'),
'*args, **kwargs'),
('no_redirect(kw)', '*args, **kwargs'),
('no_redirect(akw)', '*args, **kwargs'),