@@ -131,26 +131,28 @@ for v in x: # type: int, int # type: ignore[syntax]
131131[case testErrorCodeIgnore1]
132132'x'.foobar # type: ignore[attr-defined]
133133'x'.foobar # type: ignore[xyz] # E: "str" has no attribute "foobar" [attr-defined] \
134- # N: Error code "attr-defined" not covered by "type: ignore" comment
134+ # N: Error code "attr-defined" not covered by "type: ignore[xyz] " comment
135135'x'.foobar # type: ignore
136136
137137[case testErrorCodeIgnore2]
138138a = 'x'.foobar # type: int # type: ignore[attr-defined]
139139b = 'x'.foobar # type: int # type: ignore[xyz] # E: "str" has no attribute "foobar" [attr-defined] \
140- # N: Error code "attr-defined" not covered by "type: ignore" comment
140+ # N: Error code "attr-defined" not covered by "type: ignore[xyz] " comment
141141c = 'x'.foobar # type: int # type: ignore
142142
143143[case testErrorCodeIgnoreMultiple1]
144144a = 'x'.foobar(b) # type: ignore[name-defined, attr-defined]
145145a = 'x'.foobar(b) # type: ignore[name-defined, xyz] # E: "str" has no attribute "foobar" [attr-defined] \
146- # N: Error code "attr-defined" not covered by "type: ignore" comment
146+ # N: Error code "attr-defined" not covered by "type: ignore[name-defined, xyz] " comment
147147a = 'x'.foobar(b) # type: ignore[xyz, w, attr-defined] # E: Name "b" is not defined [name-defined] \
148- # N: Error code "name-defined" not covered by "type: ignore" comment
148+ # N: Error code "name-defined" not covered by "type: ignore[xyz, w, attr-defined]" comment
149+ a = 'x'.foobar(b) # type: ignore[ w, xyz, attr-defined] # E: Name "b" is not defined [name-defined] \
150+ # N: Error code "name-defined" not covered by "type: ignore[w, xyz, attr-defined]" comment
149151
150152[case testErrorCodeIgnoreMultiple2]
151153a = 'x'.foobar(c) # type: int # type: ignore[name-defined, attr-defined]
152154b = 'x'.foobar(c) # type: int # type: ignore[name-defined, xyz] # E: "str" has no attribute "foobar" [attr-defined] \
153- # N: Error code "attr-defined" not covered by "type: ignore" comment
155+ # N: Error code "attr-defined" not covered by "type: ignore[name-defined, xyz] " comment
154156
155157[case testErrorCodeWarnUnusedIgnores1]
156158# flags: --warn-unused-ignores
@@ -216,7 +218,7 @@ z # type: ignore[name-defined]
216218"y" # type: ignore[ignore-without-code] # E: Unused "type: ignore" comment [unused-ignore]
217219z # type: ignore[ignore-without-code] # E: Unused "type: ignore" comment [unused-ignore] \
218220 # E: Name "z" is not defined [name-defined] \
219- # N: Error code "name-defined" not covered by "type: ignore" comment
221+ # N: Error code "name-defined" not covered by "type: ignore[ignore-without-code] " comment
220222
221223[case testErrorCodeMissingWholeFileIgnores]
222224# flags: --enable-error-code ignore-without-code
@@ -242,21 +244,21 @@ x2 # type: ignore [ name-defined ]
242244x3 # type: ignore [ xyz , name-defined ]
243245x4 # type: ignore[xyz,name-defined]
244246y # type: ignore [xyz] # E: Name "y" is not defined [name-defined] \
245- # N: Error code "name-defined" not covered by "type: ignore" comment
247+ # N: Error code "name-defined" not covered by "type: ignore[xyz] " comment
246248y # type: ignore[ xyz ] # E: Name "y" is not defined [name-defined] \
247- # N: Error code "name-defined" not covered by "type: ignore" comment
249+ # N: Error code "name-defined" not covered by "type: ignore[xyz] " comment
248250y # type: ignore[ xyz , foo ] # E: Name "y" is not defined [name-defined] \
249- # N: Error code "name-defined" not covered by "type: ignore" comment
251+ # N: Error code "name-defined" not covered by "type: ignore[xyz, foo] " comment
250252
251253a = z # type: int # type: ignore [name-defined]
252254b = z2 # type: int # type: ignore [ name-defined ]
253255c = z2 # type: int # type: ignore [ name-defined , xyz ]
254256d = zz # type: int # type: ignore [xyz] # E: Name "zz" is not defined [name-defined] \
255- # N: Error code "name-defined" not covered by "type: ignore" comment
257+ # N: Error code "name-defined" not covered by "type: ignore[xyz] " comment
256258e = zz # type: int # type: ignore [ xyz ] # E: Name "zz" is not defined [name-defined] \
257- # N: Error code "name-defined" not covered by "type: ignore" comment
259+ # N: Error code "name-defined" not covered by "type: ignore[xyz] " comment
258260f = zz # type: int # type: ignore [ xyz,foo ] # E: Name "zz" is not defined [name-defined] \
259- # N: Error code "name-defined" not covered by "type: ignore" comment
261+ # N: Error code "name-defined" not covered by "type: ignore[xyz, foo] " comment
260262
261263[case testErrorCodeIgnoreAfterArgComment]
262264def f(x # type: xyz # type: ignore[name-defined] # Comment
@@ -270,7 +272,7 @@ def g(x # type: xyz # type: ignore # Comment
270272 pass
271273
272274def h(x # type: xyz # type: ignore[foo] # E: Name "xyz" is not defined [name-defined] \
273- # N: Error code "name-defined" not covered by "type: ignore" comment
275+ # N: Error code "name-defined" not covered by "type: ignore[foo] " comment
274276 ):
275277 # type () -> None
276278 pass
@@ -491,7 +493,7 @@ def y() -> int: return 2
491493def best() -> int: return 3
492494@d # type: ignore[misc] # E: Unused "type: ignore" comment [unused-ignore] \
493495 # E: Untyped decorator makes function "z" untyped [untyped-decorator] \
494- # N: Error code "untyped-decorator" not covered by "type: ignore" comment
496+ # N: Error code "untyped-decorator" not covered by "type: ignore[misc] " comment
495497def z() -> int: return 4
496498
497499[case testErrorCodeIndexing]
@@ -1127,12 +1129,12 @@ class D(TypedDict):
11271129
11281130def f(d: D, s: str) -> None:
11291131 d[s] # type: ignore[xyz] \
1130- # E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1131- # N: Error code "literal-required" not covered by "type: ignore" comment
1132+ # E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1133+ # N: Error code "literal-required" not covered by "type: ignore[xyz] " comment
11321134 d[s] # E: TypedDict key must be a string literal; expected one of ("x") [literal-required]
1133- d[s] # type: ignore[misc] \
1134- # E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1135- # N: Error code changed to literal-required; "type: ignore" comment may be out of date
1135+ d[s] # type: ignore[misc] \
1136+ # E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1137+ # N: Error code changed to literal-required; "type: ignore" comment may be out of date
11361138 d[s] # type: ignore[literal-required]
11371139[builtins fixtures/dict.pyi]
11381140[typing fixtures/typing-typeddict.pyi]
0 commit comments