Skip to content

Commit 73115d9

Browse files
committed
Add test cases for "type: ignore[unused-ignore]" interaction
1 parent ba06eb5 commit 73115d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test-data/unit/check-errorcodes.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,17 @@ x # type: ignore[name-defined, attr-defined] # E: Unused "type: ignore[attr-defi
107107

108108
[case testErrorCodeWarnUnusedIgnores7_WarnWhenErrorCodeDisabled]
109109
# flags: --warn-unused-ignores --disable-error-code name-defined
110+
x # type: ignore # E: Unused "type: ignore" comment [unused-ignore]
110111
x # type: ignore[name-defined] # E: Unused "type: ignore" comment [unused-ignore]
111112
"x".foobar(y) # type: ignore[name-defined, attr-defined] # E: Unused "type: ignore[name-defined]" comment [unused-ignore]
112113

114+
[case testErrorCodeWarnUnusedIgnores8_IgnoreUnusedIgnore]
115+
# flags: --warn-unused-ignores --disable-error-code name-defined
116+
"x" # type: ignore[unused-ignore]
117+
"x" # type: ignore[name-defined, unused-ignore]
118+
"x" # type: ignore[xyz, unused-ignore]
119+
x # type: ignore[name-defined, unused-ignore]
120+
113121
[case testErrorCodeMissingWhenRequired]
114122
# flags: --enable-error-code ignore-without-code
115123
"x" # type: ignore # E: "type: ignore" comment without error code [ignore-without-code]

0 commit comments

Comments
 (0)