Skip to content

Commit 6e75bfd

Browse files
committed
Update other affected tests
1 parent a1b132a commit 6e75bfd

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

mypy/checkexpr.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,18 +2441,13 @@ def check_argument_count(
24412441
self.msg.fail("ParamSpec.kwargs should only be passed once", context)
24422442
ok = False
24432443
if missing_contiguous_pos_block:
2444-
if ArgKind.ARG_STAR2 in actual_kinds:
2445-
# To generate a correct message, expand kwargs manually. If a name was
2446-
# missing from the call but doesn't belong to continuous positional prefix,
2447-
# it was already reported as a missing kwarg. All args before first prefix
2448-
# item are guaranteed to have been passed positionally.
2449-
names_to_use = [None] * missing_contiguous_pos_block[0] + [
2450-
name
2451-
for i, name in enumerate(callee.arg_names)
2452-
if name is not None and i not in missing_contiguous_pos_block
2453-
]
2454-
else:
2455-
names_to_use = actual_names
2444+
# To generate a correct message, expand kwargs manually. If a name was
2445+
# missing from the call but doesn't belong to continuous positional prefix,
2446+
# it was already reported as a missing kwarg. All args before first prefix
2447+
# item are guaranteed to have been passed positionally.
2448+
passed_or_reported_names = callee.arg_names[missing_contiguous_pos_block[-1] + 1 :]
2449+
assert None not in passed_or_reported_names
2450+
names_to_use = [None] * missing_contiguous_pos_block[0] + passed_or_reported_names
24562451
self.msg.too_few_arguments(callee, context, names_to_use)
24572452
if object_type and callable_name and "." in callable_name:
24582453
self.missing_classvar_callable_note(object_type, callable_name, context)

test-data/unit/check-errorcodes.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ g() # E: Missing named argument "x" for "g" [call-arg]
242242

243243
def h(x: int, y: int, z: int) -> None: pass
244244
h(y=1, z=1) # E: Missing positional argument "x" in call to "h" [call-arg]
245-
h(y=1) # E: Missing positional arguments "x", "z" in call to "h" [call-arg]
245+
h(y=1) # E: Missing named argument "z" for "h" [call-arg] \
246+
# E: Missing positional argument "x" in call to "h" [call-arg]
246247

247248
[case testErrorCodeArgType]
248249
def f(x: int) -> None: pass

test-data/unit/check-python312.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ def h(x: int, y: str) -> None: pass
889889

890890
g(h, 1, y='x')
891891
g(h, 1, x=1) # E: "g" gets multiple values for keyword argument "x" \
892-
# E: Missing positional argument "y" in call to "g"
892+
# E: Missing named argument "y" for "g"
893893

894894
class C[**P, T]:
895895
def m(self, *args: P.args, **kwargs: P.kwargs) -> T: ...

test-data/unit/check-python38.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ f(0, 0, kw=0)
154154
f(0, p_or_kw=0, kw=0)
155155
f(p=0, p_or_kw=0, kw=0) # E: Unexpected keyword argument "p" for "f"
156156
f(0, **d)
157-
f(**d) # E: Missing positional argument "p_or_kw" in call to "f"
157+
f(**d) # E: Too few arguments for "f"
158158
[builtins fixtures/dict.pyi]
159159

160160
[case testPEP570Signatures1]

test-data/unit/check-typeddict.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ f1(**a)
15961596
f2(**a) # E: Argument "y" to "f2" has incompatible type "str"; expected "int"
15971597
f3(**a) # E: Argument "x" to "f3" has incompatible type "int"; expected "B"
15981598
f4(**a) # E: Extra argument "y" from **args for "f4"
1599-
f5(**a) # E: Missing positional arguments "y", "z" in call to "f5"
1599+
f5(**a) # E: Missing named argument "z" for "f5"
16001600
f6(**a) # E: Extra argument "y" from **args for "f6"
16011601
f1(1, **a) # E: "f1" gets multiple values for keyword argument "x"
16021602
[builtins fixtures/dict.pyi]

0 commit comments

Comments
 (0)