You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test-data/unit/check-typeddict.test
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3408,3 +3408,33 @@ B = TypedDict("B", { # E: Type of a TypedDict key becomes "Any" due to an unfol
3408
3408
})
3409
3409
[builtins fixtures/dict.pyi]
3410
3410
[typing fixtures/typing-typeddict.pyi]
3411
+
3412
+
[case testTypedDictWithClassLevelKeywords]
3413
+
from typing import TypedDict, Generic, TypeVar
3414
+
3415
+
T = TypeVar('T')
3416
+
3417
+
class Meta(type): ...
3418
+
3419
+
class WithMetaKeyword(TypedDict, metaclass=Meta): # E: Unexpected keyword argument "metaclass" for "__init_subclass__" of "TypedDict"
3420
+
...
3421
+
3422
+
class GenericWithMetaKeyword(TypedDict, Generic[T], metaclass=Meta): # E: Unexpected keyword argument "metaclass" for "__init_subclass__" of "TypedDict"
3423
+
...
3424
+
3425
+
# We still don't allow this, because the implementation is much easier
3426
+
# and it does not make any practical sense to do it:
3427
+
class WithTypeMeta(TypedDict, metaclass=type): # E: Unexpected keyword argument "metaclass" for "__init_subclass__" of "TypedDict"
3428
+
...
3429
+
3430
+
class OtherKeywords(TypedDict, a=1, b=2, c=3, total=True): # E: Unexpected keyword argument "a" for "__init_subclass__" of "TypedDict" \
3431
+
# E: Unexpected keyword argument "b" for "__init_subclass__" of "TypedDict" \
3432
+
# E: Unexpected keyword argument "c" for "__init_subclass__" of "TypedDict"
3433
+
...
3434
+
3435
+
class TotalInTheMiddle(TypedDict, a=1, total=True, b=2, c=3): # E: Unexpected keyword argument "a" for "__init_subclass__" of "TypedDict" \
3436
+
# E: Unexpected keyword argument "b" for "__init_subclass__" of "TypedDict" \
3437
+
# E: Unexpected keyword argument "c" for "__init_subclass__" of "TypedDict"
0 commit comments