@@ -66,7 +66,7 @@ p = Point(x=42, y=1337, z=666) # E: Extra key 'z' for TypedDict "Point"
66
66
[case testCannotCreateTypedDictInstanceWithMissingItems]
67
67
from mypy_extensions import TypedDict
68
68
Point = TypedDict('Point', {'x': int, 'y': int})
69
- p = Point(x=42) # E: Key 'y' missing for TypedDict "Point"
69
+ p = Point(x=42) # E: Missing key 'y' for TypedDict "Point"
70
70
[builtins fixtures/dict.pyi]
71
71
72
72
[case testCannotCreateTypedDictInstanceWithIncompatibleItemType]
@@ -149,7 +149,7 @@ def foo(x):
149
149
# type: (Movie) -> None
150
150
pass
151
151
152
- foo({}) # E: Keys ('name', 'year') missing for TypedDict "Movie"
152
+ foo({}) # E: Missing keys ('name', 'year') for TypedDict "Movie"
153
153
foo({'name': 'lol', 'year': 2009, 'based_on': 0}) # E: Incompatible types (expression has type "int", TypedDict item "based_on" has type "str")
154
154
155
155
[builtins fixtures/dict.pyi]
@@ -871,7 +871,7 @@ Point = TypedDict('Point', {'x': int, 'y': int})
871
871
def f(p: Point) -> None:
872
872
if int():
873
873
p = {'x': 2, 'y': 3}
874
- p = {'x': 2} # E: Key 'y' missing for TypedDict "Point"
874
+ p = {'x': 2} # E: Missing key 'y' for TypedDict "Point"
875
875
p = dict(x=2, y=3)
876
876
877
877
f({'x': 1, 'y': 3})
@@ -888,15 +888,15 @@ from mypy_extensions import TypedDict
888
888
889
889
Point = TypedDict('Point', {'x': int, 'y': int})
890
890
891
- p1a: Point = {'x': 'hi'} # E: Key 'y' missing for TypedDict "Point"
892
- p1b: Point = {} # E: Keys ('x', 'y') missing for TypedDict "Point"
891
+ p1a: Point = {'x': 'hi'} # E: Missing key 'y' for TypedDict "Point"
892
+ p1b: Point = {} # E: Missing keys ('x', 'y') for TypedDict "Point"
893
893
894
894
p2: Point
895
- p2 = dict(x='bye') # E: Key 'y' missing for TypedDict "Point"
895
+ p2 = dict(x='bye') # E: Missing key 'y' for TypedDict "Point"
896
896
897
897
p3 = Point(x=1, y=2)
898
898
if int():
899
- p3 = {'x': 'hi'} # E: Key 'y' missing for TypedDict "Point"
899
+ p3 = {'x': 'hi'} # E: Missing key 'y' for TypedDict "Point"
900
900
901
901
p4: Point = {'x': 1, 'y': 2}
902
902
@@ -2103,3 +2103,10 @@ d[3] # E: TypedDict key must be a string literal; expected one of ('foo')
2103
2103
d[True] # E: TypedDict key must be a string literal; expected one of ('foo')
2104
2104
[builtins fixtures/dict.pyi]
2105
2105
[typing fixtures/typing-typeddict.pyi]
2106
+
2107
+ [case testTypedDictUppercaseKey]
2108
+ from mypy_extensions import TypedDict
2109
+
2110
+ Foo = TypedDict('Foo', {'camelCaseKey': str})
2111
+ value: Foo = {} # E: Missing key 'camelCaseKey' for TypedDict "Foo"
2112
+ [builtins fixtures/dict.pyi]
0 commit comments