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
def h(x # type: xyz # type: ignore[foo] # E: Name "xyz" is not defined [name-defined] \
188
-
# N: Error code "name-defined" not covered by "type: ignore" comment
201
+
# N: Error code "name-defined" not covered by "type: ignore" comment ignoring [foo]
189
202
):
190
203
# type () -> None
191
204
pass
192
205
206
+
193
207
[case testErrorCodeIgnoreWithNote]
194
208
import nostub # type: ignore[import]
195
209
from defusedxml import xyz # type: ignore[import]
@@ -1011,27 +1025,31 @@ class D(TypedDict):
1011
1025
x: int
1012
1026
1013
1027
def f(d: D, s: str) -> None:
1014
-
d[s] # type: ignore[xyz] \
1015
-
# E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1016
-
# N: Error code "literal-required" not covered by "type: ignore" comment
1028
+
d[s] # type: ignore[xyz] # E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1029
+
# N: Error code "literal-required" not covered by "type: ignore" comment ignoring [xyz]
1017
1030
d[s] # E: TypedDict key must be a string literal; expected one of ("x") [literal-required]
1018
-
d[s] # type: ignore[misc] \
1019
-
# E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1020
-
# N: Error code changed to literal-required; "type: ignore" comment may be out of date
1031
+
d[s] # type: ignore[misc] # E: TypedDict key must be a string literal; expected one of ("x") [literal-required] \
1032
+
# N: Error code changed to literal-required; "type: ignore" comment may be out of date
1021
1033
d[s] # type: ignore[literal-required]
1034
+
1035
+
1036
+
1037
+
1022
1038
[builtins fixtures/dict.pyi]
1023
1039
[typing fixtures/typing-typeddict.pyi]
1024
1040
1025
1041
[case testRecommendErrorCode]
1026
1042
# type: ignore[whatever] # E: type ignore with error code is not supported for modules; use `# mypy: disable-error-code="whatever"` [syntax] \
1027
-
# N: Error code "syntax" not covered by "type: ignore" comment
1043
+
# N: Error code "syntax" not covered by "type: ignore" comment ignoring [whatever]
1028
1044
1 + "asdf"
1029
1045
1046
+
1030
1047
[case testRecommendErrorCode2]
1031
1048
# type: ignore[whatever, other] # E: type ignore with error code is not supported for modules; use `# mypy: disable-error-code="whatever, other"` [syntax] \
1032
-
# N: Error code "syntax" not covered by "type: ignore" comment
1049
+
# N: Error code "syntax" not covered by "type: ignore" comment ignoring [whatever, other]
1033
1050
1 + "asdf"
1034
1051
1052
+
1035
1053
[case testShowErrorCodesInConfig]
1036
1054
# flags: --config-file tmp/mypy.ini
1037
1055
# Test 'show_error_codes = True' in config doesn't raise an exception
0 commit comments