Skip to content

Commit dc3c31e

Browse files
committed
spec, conformance: add PEP 728
I mostly copied the spec from PEP 728, with light editing to remove references to "this PEP" and fix links. In a followup I plan to reorganize the TypedDict spec. The conformance tests primarily derive from the examples in the PEP.
1 parent 945656b commit dc3c31e

File tree

5 files changed

+1248
-0
lines changed

5 files changed

+1248
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
conformant = "Fail"
2+
notes = """
3+
Not supported.
4+
"""
5+
conformance_automated = "Fail"
6+
errors_diff = """
7+
Line 181: Expected 1 errors
8+
Line 184: Expected 1 errors
9+
Line 206: Expected 1 errors
10+
Line 213: Expected 1 errors
11+
Line 233: Expected 1 errors
12+
Line 247: Expected 1 errors
13+
Line 248: Expected 1 errors
14+
Line 259: Expected 1 errors
15+
Lines 91, 92: Expected error (tag 'MovieC')
16+
Lines 94, 95: Expected error (tag 'MovieD')
17+
Line 11: Unexpected errors ['typeddicts_extra_items.py:11: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
18+
Line 14: Unexpected errors ['typeddicts_extra_items.py:14: error: Extra key "novel_adaptation" for TypedDict "Movie" [typeddict-unknown-key]']
19+
Line 19: Unexpected errors ['typeddicts_extra_items.py:19: error: Unexpected keyword argument "extra_items" for "TypedDict" [misc]']
20+
Line 21: Unexpected errors ['typeddicts_extra_items.py:21: error: Extra keys ("name", "novel_adaptation") for TypedDict "MovieFunctional" [typeddict-unknown-key]']
21+
Line 29: Unexpected errors ['typeddicts_extra_items.py:29: error: Expression is of type "Any", not "bool" [assert-type]', 'typeddicts_extra_items.py:29: error: TypedDict "Movie" has no key "novel_adaptation" [typeddict-item]']
22+
Line 33: Unexpected errors ['typeddicts_extra_items.py:33: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
23+
Line 40: Unexpected errors ['typeddicts_extra_items.py:40: error: Extra key "other_extra_key" for TypedDict "InheritedMovie" [typeddict-unknown-key]']
24+
Line 55: Unexpected errors ['typeddicts_extra_items.py:55: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']
25+
Line 64: Unexpected errors ['typeddicts_extra_items.py:64: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']
26+
Line 70: Unexpected errors ['typeddicts_extra_items.py:70: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
27+
Line 82: Unexpected errors ['typeddicts_extra_items.py:82: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']
28+
Line 88: Unexpected errors ['typeddicts_extra_items.py:88: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']
29+
Line 100: Unexpected errors ['typeddicts_extra_items.py:100: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
30+
Line 103: Unexpected errors ['typeddicts_extra_items.py:103: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']
31+
Line 106: Unexpected errors ['typeddicts_extra_items.py:106: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
32+
Line 121: Unexpected errors ['typeddicts_extra_items.py:121: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
33+
Line 126: Unexpected errors ['typeddicts_extra_items.py:126: error: TypedDict "MovieEI" has no key "year" [typeddict-item]']
34+
Line 134: Unexpected errors ['typeddicts_extra_items.py:134: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
35+
Line 141: Unexpected errors ['typeddicts_extra_items.py:141: error: Unexpected keyword argument "year" for "unpack_extra" [call-arg]']
36+
Line 146: Unexpected errors ['typeddicts_extra_items.py:146: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
37+
Line 149: Unexpected errors ['typeddicts_extra_items.py:149: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
38+
Line 152: Unexpected errors ['typeddicts_extra_items.py:152: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
39+
Line 162: Unexpected errors ['typeddicts_extra_items.py:162: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
40+
Line 168: Unexpected errors ['typeddicts_extra_items.py:168: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
41+
Line 178: Unexpected errors ['typeddicts_extra_items.py:178: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
42+
Line 201: Unexpected errors ['typeddicts_extra_items.py:201: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
43+
Line 208: Unexpected errors ['typeddicts_extra_items.py:208: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
44+
Line 219: Unexpected errors ['typeddicts_extra_items.py:219: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
45+
Line 222: Unexpected errors ['typeddicts_extra_items.py:222: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
46+
Line 226: Unexpected errors ['typeddicts_extra_items.py:226: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
47+
Line 239: Unexpected errors ['typeddicts_extra_items.py:239: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
48+
Line 242: Unexpected errors ['typeddicts_extra_items.py:242: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
49+
Line 245: Unexpected errors ['typeddicts_extra_items.py:245: error: Extra key "year" for TypedDict "MovieExtraInt" [typeddict-unknown-key]']
50+
Line 246: Unexpected errors ['typeddicts_extra_items.py:246: error: Extra key "description" for TypedDict "MovieExtraStr" [typeddict-unknown-key]']
51+
Line 257: Unexpected errors ['typeddicts_extra_items.py:257: error: Extra key "year" for TypedDict "MovieExtraInt" [typeddict-unknown-key]']
52+
Line 271: Unexpected errors ['typeddicts_extra_items.py:271: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
53+
Line 275: Unexpected errors ['typeddicts_extra_items.py:275: error: Extra key "year" for TypedDict "ExtraMovie" [typeddict-unknown-key]']
54+
Line 280: Unexpected errors ['typeddicts_extra_items.py:280: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]']
55+
Line 290: Unexpected errors ['typeddicts_extra_items.py:290: error: Extra key "summary" for TypedDict "MovieExtraStr" [typeddict-unknown-key]']
56+
Line 291: Unexpected errors ['typeddicts_extra_items.py:291: error: Incompatible types in assignment (expression has type "MovieExtraStr", variable has type "Mapping[str, str]") [assignment]']
57+
Line 293: Unexpected errors ['typeddicts_extra_items.py:293: error: Extra key "year" for TypedDict "MovieExtraInt" [typeddict-unknown-key]']
58+
Line 295: Unexpected errors ['typeddicts_extra_items.py:295: error: Incompatible types in assignment (expression has type "MovieExtraInt", variable has type "Mapping[str, int | str]") [assignment]']
59+
Line 301: Unexpected errors ['typeddicts_extra_items.py:301: error: Expression is of type "list[tuple[str, object]]", not "list[tuple[str, int | str]]" [assert-type]']
60+
Line 302: Unexpected errors ['typeddicts_extra_items.py:302: error: Expression is of type "list[object]", not "list[int | str]" [assert-type]']
61+
Line 310: Unexpected errors ['typeddicts_extra_items.py:310: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
62+
Line 317: Unexpected errors ['typeddicts_extra_items.py:317: error: Incompatible types in assignment (expression has type "IntDict", variable has type "dict[str, int]") [assignment]']
63+
Line 320: Unexpected errors ['typeddicts_extra_items.py:320: error: Extra key "bar" for TypedDict "IntDictWithNum" [typeddict-unknown-key]']
64+
Line 321: Unexpected errors ['typeddicts_extra_items.py:321: error: Incompatible types in assignment (expression has type "IntDictWithNum", variable has type "dict[str, int]") [assignment]']
65+
Line 328: Unexpected errors ['typeddicts_extra_items.py:328: error: "IntDictWithNum" has no attribute "clear" [attr-defined]']
66+
Line 330: Unexpected errors ['typeddicts_extra_items.py:330: error: Expression is of type "Any", not "tuple[str, int]" [assert-type]', 'typeddicts_extra_items.py:330: error: "IntDictWithNum" has no attribute "popitem" [attr-defined]']
67+
Line 333: Unexpected errors ['typeddicts_extra_items.py:333: error: TypedDict key must be a string literal; expected one of ("num") [literal-required]']
68+
Line 334: Unexpected errors ['typeddicts_extra_items.py:334: error: Expected TypedDict key to be string literal [misc]']
69+
"""
70+
output = """
71+
typeddicts_extra_items.py:11: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
72+
typeddicts_extra_items.py:14: error: Extra key "novel_adaptation" for TypedDict "Movie" [typeddict-unknown-key]
73+
typeddicts_extra_items.py:15: error: Extra key "year" for TypedDict "Movie" [typeddict-unknown-key]
74+
typeddicts_extra_items.py:19: error: Unexpected keyword argument "extra_items" for "TypedDict" [misc]
75+
typeddicts_extra_items.py:21: error: Extra keys ("name", "novel_adaptation") for TypedDict "MovieFunctional" [typeddict-unknown-key]
76+
typeddicts_extra_items.py:22: error: Extra keys ("name", "year") for TypedDict "MovieFunctional" [typeddict-unknown-key]
77+
typeddicts_extra_items.py:29: error: Expression is of type "Any", not "bool" [assert-type]
78+
typeddicts_extra_items.py:29: error: TypedDict "Movie" has no key "novel_adaptation" [typeddict-item]
79+
typeddicts_extra_items.py:33: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
80+
typeddicts_extra_items.py:39: error: Incompatible types (expression has type "None", TypedDict item "year" has type "int") [typeddict-item]
81+
typeddicts_extra_items.py:40: error: Extra key "other_extra_key" for TypedDict "InheritedMovie" [typeddict-unknown-key]
82+
typeddicts_extra_items.py:49: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
83+
typeddicts_extra_items.py:55: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
84+
typeddicts_extra_items.py:64: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
85+
typeddicts_extra_items.py:67: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
86+
typeddicts_extra_items.py:70: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
87+
typeddicts_extra_items.py:73: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
88+
typeddicts_extra_items.py:82: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
89+
typeddicts_extra_items.py:88: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
90+
typeddicts_extra_items.py:100: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
91+
typeddicts_extra_items.py:103: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
92+
typeddicts_extra_items.py:106: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
93+
typeddicts_extra_items.py:111: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
94+
typeddicts_extra_items.py:114: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
95+
typeddicts_extra_items.py:121: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
96+
typeddicts_extra_items.py:125: error: Key "name" of TypedDict "MovieEI" cannot be deleted [misc]
97+
typeddicts_extra_items.py:126: error: TypedDict "MovieEI" has no key "year" [typeddict-item]
98+
typeddicts_extra_items.py:134: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
99+
typeddicts_extra_items.py:137: note: "unpack_no_extra" defined here
100+
typeddicts_extra_items.py:138: note: "unpack_extra" defined here
101+
typeddicts_extra_items.py:140: error: Unexpected keyword argument "year" for "unpack_no_extra" [call-arg]
102+
typeddicts_extra_items.py:141: error: Unexpected keyword argument "year" for "unpack_extra" [call-arg]
103+
typeddicts_extra_items.py:146: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
104+
typeddicts_extra_items.py:149: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
105+
typeddicts_extra_items.py:152: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
106+
typeddicts_extra_items.py:162: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
107+
typeddicts_extra_items.py:168: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
108+
typeddicts_extra_items.py:171: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
109+
typeddicts_extra_items.py:178: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
110+
typeddicts_extra_items.py:201: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
111+
typeddicts_extra_items.py:208: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
112+
typeddicts_extra_items.py:219: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
113+
typeddicts_extra_items.py:222: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
114+
typeddicts_extra_items.py:226: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
115+
typeddicts_extra_items.py:239: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
116+
typeddicts_extra_items.py:242: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
117+
typeddicts_extra_items.py:245: error: Extra key "year" for TypedDict "MovieExtraInt" [typeddict-unknown-key]
118+
typeddicts_extra_items.py:246: error: Extra key "description" for TypedDict "MovieExtraStr" [typeddict-unknown-key]
119+
typeddicts_extra_items.py:257: error: Extra key "year" for TypedDict "MovieExtraInt" [typeddict-unknown-key]
120+
typeddicts_extra_items.py:269: error: Extra key "year" for TypedDict "NonClosedMovie" [typeddict-unknown-key]
121+
typeddicts_extra_items.py:271: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
122+
typeddicts_extra_items.py:275: error: Extra key "year" for TypedDict "ExtraMovie" [typeddict-unknown-key]
123+
typeddicts_extra_items.py:276: error: Extra key "language" for TypedDict "ExtraMovie" [typeddict-unknown-key]
124+
typeddicts_extra_items.py:280: error: Unexpected keyword argument "closed" for "__init_subclass__" of "TypedDict" [call-arg]
125+
typeddicts_extra_items.py:284: error: Extra key "year" for TypedDict "ClosedMovie" [typeddict-unknown-key]
126+
typeddicts_extra_items.py:290: error: Extra key "summary" for TypedDict "MovieExtraStr" [typeddict-unknown-key]
127+
typeddicts_extra_items.py:291: error: Incompatible types in assignment (expression has type "MovieExtraStr", variable has type "Mapping[str, str]") [assignment]
128+
typeddicts_extra_items.py:293: error: Extra key "year" for TypedDict "MovieExtraInt" [typeddict-unknown-key]
129+
typeddicts_extra_items.py:294: error: Incompatible types in assignment (expression has type "MovieExtraInt", variable has type "Mapping[str, int]") [assignment]
130+
typeddicts_extra_items.py:295: error: Incompatible types in assignment (expression has type "MovieExtraInt", variable has type "Mapping[str, int | str]") [assignment]
131+
typeddicts_extra_items.py:301: error: Expression is of type "list[tuple[str, object]]", not "list[tuple[str, int | str]]" [assert-type]
132+
typeddicts_extra_items.py:302: error: Expression is of type "list[object]", not "list[int | str]" [assert-type]
133+
typeddicts_extra_items.py:310: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
134+
typeddicts_extra_items.py:317: error: Incompatible types in assignment (expression has type "IntDict", variable has type "dict[str, int]") [assignment]
135+
typeddicts_extra_items.py:320: error: Extra key "bar" for TypedDict "IntDictWithNum" [typeddict-unknown-key]
136+
typeddicts_extra_items.py:321: error: Incompatible types in assignment (expression has type "IntDictWithNum", variable has type "dict[str, int]") [assignment]
137+
typeddicts_extra_items.py:328: error: "IntDictWithNum" has no attribute "clear" [attr-defined]
138+
typeddicts_extra_items.py:330: error: Expression is of type "Any", not "tuple[str, int]" [assert-type]
139+
typeddicts_extra_items.py:330: error: "IntDictWithNum" has no attribute "popitem" [attr-defined]
140+
typeddicts_extra_items.py:333: error: TypedDict key must be a string literal; expected one of ("num") [literal-required]
141+
typeddicts_extra_items.py:334: error: Expected TypedDict key to be string literal [misc]
142+
typeddicts_extra_items.py:343: error: Incompatible types in assignment (expression has type "dict[str, int]", variable has type "IntDict") [assignment]
143+
"""

0 commit comments

Comments
 (0)