Skip to content

Commit 33bfbbb

Browse files
committed
Keep repeated extra_items kwarg case out of the parallel test suite
The native parser (forced on with --mypy-num-workers>0) reports a repeated keyword argument as a blocking syntax error, which aborts semantic analysis and suppresses the other errors in the file. Split the repeated-keyword case out of testTypedDictExtraItemsInvalidArgument into a _no_parallel test, mirroring testTypedDictWithDuplicateKeywordArguments_no_parallel.
1 parent 8c3f44d commit 33bfbbb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

test-data/unit/check-typeddict.test

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6175,11 +6175,18 @@ class B(TypedDict, extra_items=NotRequired[int]): # E: "NotRequired[]" is not a
61756175
x: int
61766176
C = TypedDict('C', {'x': int}, extra_items=Required[str]) # E: "Required[]" is not allowed in "extra_items"
61776177
D = TypedDict('D', {'x': int}, extra_items=[str]) # E: Bracketed expression "[...]" is not valid as a type # N: Did you mean "List[...]"?
6178-
E = TypedDict('E', {'x': int}, extra_items=int, extra_items=str) # E: Repeated keyword argument "extra_items" for "TypedDict"
61796178
F = TypedDict('F', {'x': int}, extra_items=lambda: 0) # E: Invalid "extra_items" argument
61806179
[builtins fixtures/dict.pyi]
61816180
[typing fixtures/typing-typeddict.pyi]
61826181

6182+
[case testTypedDictExtraItemsRepeatedKeyword_no_parallel]
6183+
# The native parser treats a repeated keyword argument as a blocking syntax
6184+
# error, so this case is kept out of the parallel suite (which forces it on).
6185+
from typing import TypedDict
6186+
E = TypedDict('E', {'x': int}, extra_items=int, extra_items=str) # E: Repeated keyword argument "extra_items" for "TypedDict"
6187+
[builtins fixtures/dict.pyi]
6188+
[typing fixtures/typing-typeddict.pyi]
6189+
61836190
[case testTypedDictExtraItemsSubclassingInherited]
61846191
from typing import ReadOnly, TypedDict
61856192
class MovieBase(TypedDict, extra_items=ReadOnly[int]):

0 commit comments

Comments
 (0)