Skip to content

Commit 20a9e41

Browse files
committed
add additional conformance test cases
1 parent b0ac496 commit 20a9e41

9 files changed

Lines changed: 110 additions & 51 deletions

File tree

conformance/results/mypy/callables_kwargs.toml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ notes = """
33
Allows callable without kwargs to be assigned to callable with unpacked kwargs.
44
Does not support the `closed` and `extra_items` TypedDict class arguments.
55
Does not check the type of an unpacked TypedDict's extra items against the target callable's `**kwargs` annotation.
6+
Does not check the type of an unpacked TypedDict's extra items against the target callable's named keyword parameters.
67
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable that has no `**kwargs`.
8+
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable whose `**kwargs` is typed with a closed TypedDict.
79
"""
810
output = """
911
callables_kwargs.py:23: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
@@ -35,14 +37,18 @@ callables_kwargs.py:178: error: Unexpected keyword argument "extra_items" for "_
3537
conformance_automated = "Fail"
3638
errors_diff = """
3739
Line 154: Expected 1 errors
38-
Line 206: Expected 1 errors
39-
Line 209: Expected 1 errors
40+
Line 212: Expected 1 errors
4041
Line 215: Expected 1 errors
41-
Line 218: Expected 1 errors
42-
Line 231: Expected 1 errors
43-
Line 232: Expected 1 errors
44-
Line 234: Expected 1 errors
45-
Line 235: Expected 1 errors
42+
Line 223: Expected 1 errors
43+
Line 226: Expected 1 errors
44+
Line 243: Expected 1 errors
45+
Line 244: Expected 1 errors
46+
Line 246: Expected 1 errors
47+
Line 247: Expected 1 errors
48+
Line 249: Expected 1 errors
49+
Line 250: Expected 1 errors
50+
Line 251: Expected 1 errors
51+
Line 252: Expected 1 errors
4652
Line 23: Unexpected errors ['callables_kwargs.py:23: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']
4753
Line 27: Unexpected errors ['callables_kwargs.py:27: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
4854
Line 166: Unexpected errors ['callables_kwargs.py:166: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']

conformance/results/pycroscope/callables_kwargs.toml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
conformant = "Partial"
22
notes = """
33
Does not check the type of an unpacked TypedDict's extra items against the target callable's `**kwargs` annotation.
4+
Does not check the type of an unpacked TypedDict's extra items against the target callable's named keyword parameters.
45
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable that has no `**kwargs`.
6+
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable whose `**kwargs` is typed with a closed TypedDict.
57
Incorrectly rejects assigning a callable without `**kwargs` to a callable whose `**kwargs` is typed with a closed TypedDict or one that sets `extra_items=Never`.
68
"""
79
conformance_automated = "Fail"
810
errors_diff = """
9-
Line 206: Expected 1 errors
10-
Line 209: Expected 1 errors
11+
Line 212: Expected 1 errors
1112
Line 215: Expected 1 errors
12-
Line 218: Expected 1 errors
13-
Line 231: Expected 1 errors
14-
Line 232: Expected 1 errors
15-
Line 234: Expected 1 errors
16-
Line 235: Expected 1 errors
13+
Line 223: Expected 1 errors
14+
Line 226: Expected 1 errors
15+
Line 243: Expected 1 errors
16+
Line 244: Expected 1 errors
17+
Line 246: Expected 1 errors
18+
Line 247: Expected 1 errors
19+
Line 249: Expected 1 errors
20+
Line 250: Expected 1 errors
21+
Line 251: Expected 1 errors
22+
Line 252: Expected 1 errors
1723
Line 155: Unexpected errors ["./callables_kwargs.py:155:0: Incompatible assignment: expected callables_kwargs.TDProtocol7, got function 'callables_kwargs.func7' [incompatible_assignment]"]
1824
Line 156: Unexpected errors ["./callables_kwargs.py:156:0: Incompatible assignment: expected callables_kwargs.TDProtocol8, got function 'callables_kwargs.func7' [incompatible_assignment]"]
1925
"""

conformance/results/pyrefly/callables_kwargs.toml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
conformant = "Partial"
22
notes = """
33
Does not check the type of an unpacked TypedDict's extra items against the target callable's `**kwargs` annotation.
4+
Does not check the type of an unpacked TypedDict's extra items against the target callable's named keyword parameters.
45
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable that has no `**kwargs`.
6+
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable whose `**kwargs` is typed with a closed TypedDict.
57
Incorrectly rejects assigning a callable without `**kwargs` to a callable whose `**kwargs` is typed with a TypedDict that sets `extra_items=Never`.
68
"""
79
conformance_automated = "Fail"
810
errors_diff = """
9-
Line 206: Expected 1 errors
10-
Line 209: Expected 1 errors
11+
Line 212: Expected 1 errors
1112
Line 215: Expected 1 errors
12-
Line 218: Expected 1 errors
13-
Line 231: Expected 1 errors
14-
Line 232: Expected 1 errors
15-
Line 234: Expected 1 errors
16-
Line 235: Expected 1 errors
13+
Line 223: Expected 1 errors
14+
Line 226: Expected 1 errors
15+
Line 243: Expected 1 errors
16+
Line 244: Expected 1 errors
17+
Line 246: Expected 1 errors
18+
Line 247: Expected 1 errors
19+
Line 249: Expected 1 errors
20+
Line 250: Expected 1 errors
21+
Line 251: Expected 1 errors
22+
Line 252: Expected 1 errors
1723
Line 156: Unexpected errors ["`(*, v1: int, v3: str, v2: str = '') -> None` is not assignable to `TDProtocol8` [bad-assignment]"]
1824
"""
1925
output = """

conformance/results/pyright/callables_kwargs.toml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
conformant = "Partial"
22
notes = """
33
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable that has no `**kwargs`.
4+
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable whose `**kwargs` is typed with a closed TypedDict.
5+
Does not check the type of an unpacked TypedDict's extra items against the target callable's named keyword parameters.
46
"""
57
output = """
68
callables_kwargs.py:37:5 - error: Could not access item in TypedDict
@@ -33,21 +35,25 @@ callables_kwargs.py:142:21 - error: Expected TypedDict type argument for Unpack
3335
callables_kwargs.py:154:19 - error: Type "(*, v1: int, v3: str, v2: str = "") -> None" is not assignable to declared type "TDProtocol6"
3436
  Type "(*, v1: int, v3: str, v2: str = "") -> None" is not assignable to type "(**kwargs: **TD2) -> None"
3537
    Parameter "**kwargs" has no corresponding parameter (reportAssignmentType)
36-
callables_kwargs.py:206:29 - error: Argument of type "object" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
37-
  "object" is not assignable to "str" (reportArgumentType)
38-
callables_kwargs.py:209:29 - error: Argument of type "object" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
38+
callables_kwargs.py:212:29 - error: Argument of type "object" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
3939
  "object" is not assignable to "str" (reportArgumentType)
4040
callables_kwargs.py:215:29 - error: Argument of type "object" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
4141
  "object" is not assignable to "str" (reportArgumentType)
42-
callables_kwargs.py:218:29 - error: Argument of type "object" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
42+
callables_kwargs.py:223:29 - error: Argument of type "object" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
43+
  "object" is not assignable to "str" (reportArgumentType)
44+
callables_kwargs.py:226:29 - error: Argument of type "object" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
4345
  "object" is not assignable to "str" (reportArgumentType)
44-
callables_kwargs.py:232:29 - error: Argument of type "int" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
46+
callables_kwargs.py:244:29 - error: Argument of type "int" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
4547
  "int" is not assignable to "str" (reportArgumentType)
46-
callables_kwargs.py:235:29 - error: Argument of type "int" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
48+
callables_kwargs.py:247:29 - error: Argument of type "int" cannot be assigned to parameter "kwargs" of type "str" in function "takes_name_str_kwargs"
4749
  "int" is not assignable to "str" (reportArgumentType)
4850
"""
4951
conformance_automated = "Fail"
5052
errors_diff = """
51-
Line 231: Expected 1 errors
52-
Line 234: Expected 1 errors
53+
Line 243: Expected 1 errors
54+
Line 246: Expected 1 errors
55+
Line 249: Expected 1 errors
56+
Line 250: Expected 1 errors
57+
Line 251: Expected 1 errors
58+
Line 252: Expected 1 errors
5359
"""

conformance/results/results.html

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conformance/results/ty/callables_kwargs.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ callables_kwargs.py:123:19: error[invalid-assignment] Object of type `def func1(
1818
callables_kwargs.py:131:20: error[invalid-type-form] Parameter `v1` overlaps with unpacked TypedDict key in `**kwargs` annotation
1919
callables_kwargs.py:142:21: error[invalid-type-form] Unpacked value for `**kwargs` must be a TypedDict, not `T@func6`
2020
callables_kwargs.py:154:19: error[invalid-assignment] Object of type `def func7(*, v1: int, v3: str, v2: str = "") -> None` is not assignable to `TDProtocol6`
21-
callables_kwargs.py:206:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Possible extra items in unpacked open `TypedDict` have type `object`, expected `str`
22-
callables_kwargs.py:209:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Possible extra items in unpacked open `TypedDict` have type `object`, expected `str`
21+
callables_kwargs.py:212:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Possible extra items in unpacked open `TypedDict` have type `object`, expected `str`
2322
callables_kwargs.py:215:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Possible extra items in unpacked open `TypedDict` have type `object`, expected `str`
24-
callables_kwargs.py:218:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Possible extra items in unpacked open `TypedDict` have type `object`, expected `str`
25-
callables_kwargs.py:231:16: error[unknown-argument] Unpacked argument may contain keyword arguments that do not match any known parameter of function `takes_name`
26-
callables_kwargs.py:232:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Expected `str`, found `int`
27-
callables_kwargs.py:234:16: error[unknown-argument] Unpacked argument may contain keyword arguments that do not match any known parameter of function `takes_name`
28-
callables_kwargs.py:235:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Expected `str`, found `int`
23+
callables_kwargs.py:223:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Possible extra items in unpacked open `TypedDict` have type `object`, expected `str`
24+
callables_kwargs.py:226:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Possible extra items in unpacked open `TypedDict` have type `object`, expected `str`
25+
callables_kwargs.py:243:16: error[unknown-argument] Unpacked argument may contain keyword arguments that do not match any known parameter of function `takes_name`
26+
callables_kwargs.py:244:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Expected `str`, found `int`
27+
callables_kwargs.py:246:16: error[unknown-argument] Unpacked argument may contain keyword arguments that do not match any known parameter of function `takes_name`
28+
callables_kwargs.py:247:27: error[invalid-argument-type] Argument to function `takes_name_str_kwargs` is incorrect: Expected `str`, found `int`
29+
callables_kwargs.py:249:18: error[unknown-argument] Unpacked argument may contain keyword arguments that do not match any known parameter of function `takes_closed`
30+
callables_kwargs.py:250:18: error[unknown-argument] Unpacked argument may contain keyword arguments that do not match any known parameter of function `takes_closed`
31+
callables_kwargs.py:251:37: error[invalid-argument-type] Argument to function `takes_optional_label_int_kwargs` is incorrect: Expected `str`, found `int`
32+
callables_kwargs.py:252:37: error[invalid-argument-type] Argument to function `takes_optional_label_int_kwargs` is incorrect: Expected `str`, found `int`
2933
"""

conformance/results/zuban/callables_kwargs.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Incorrectly rejects assigning a callable without `**kwargs` to a callable whose
66
"""
77
conformance_automated = "Fail"
88
errors_diff = """
9-
Line 206: Expected 1 errors
10-
Line 209: Expected 1 errors
9+
Line 212: Expected 1 errors
1110
Line 215: Expected 1 errors
12-
Line 218: Expected 1 errors
13-
Line 231: Expected 1 errors
14-
Line 234: Expected 1 errors
11+
Line 223: Expected 1 errors
12+
Line 226: Expected 1 errors
13+
Line 243: Expected 1 errors
14+
Line 246: Expected 1 errors
1515
Line 155: Unexpected errors ['callables_kwargs.py:155: error: Incompatible types in assignment (expression has type "def func7(*, v1: int, v3: str, v2: str = ...) -> None", variable has type "TDProtocol7") [assignment]']
1616
Line 156: Unexpected errors ['callables_kwargs.py:156: error: Incompatible types in assignment (expression has type "def func7(*, v1: int, v3: str, v2: str = ...) -> None", variable has type "TDProtocol8") [assignment]']
1717
"""
@@ -38,6 +38,10 @@ callables_kwargs.py:142: error: Unpack item in ** parameter must be a TypedDict
3838
callables_kwargs.py:154: error: Incompatible types in assignment (expression has type "def func7(*, v1: int, v3: str, v2: str = ...) -> None", variable has type "TDProtocol6") [assignment]
3939
callables_kwargs.py:155: error: Incompatible types in assignment (expression has type "def func7(*, v1: int, v3: str, v2: str = ...) -> None", variable has type "TDProtocol7") [assignment]
4040
callables_kwargs.py:156: error: Incompatible types in assignment (expression has type "def func7(*, v1: int, v3: str, v2: str = ...) -> None", variable has type "TDProtocol8") [assignment]
41-
callables_kwargs.py:232: error: Argument 1 to "takes_name_str_kwargs" has incompatible type "**TDExtraItems"; expected "str" [arg-type]
42-
callables_kwargs.py:235: error: Argument 1 to "takes_name_str_kwargs" has incompatible type "**TDExtraItems"; expected "str" [arg-type]
41+
callables_kwargs.py:244: error: Argument 1 to "takes_name_str_kwargs" has incompatible type "**TDExtraItems"; expected "str" [arg-type]
42+
callables_kwargs.py:247: error: Argument 1 to "takes_name_str_kwargs" has incompatible type "**TDExtraItems"; expected "str" [arg-type]
43+
callables_kwargs.py:249: error: Argument 1 to "takes_closed" has incompatible type "**TDExtraItems"; expected "Never" [arg-type]
44+
callables_kwargs.py:250: error: Argument 1 to "takes_closed" has incompatible type "**TDExtraItems"; expected "Never" [arg-type]
45+
callables_kwargs.py:251: error: Argument 1 to "takes_optional_label_int_kwargs" has incompatible type "**TDExtraItems"; expected "str" [arg-type]
46+
callables_kwargs.py:252: error: Argument 1 to "takes_optional_label_int_kwargs" has incompatible type "**TDExtraItems"; expected "str" [arg-type]
4347
"""

0 commit comments

Comments
 (0)