Skip to content

Commit

Permalink
Add tests for the behavior of # type: ignore on import statements (#…
Browse files Browse the repository at this point in the history
…1740)

These should cause mypy to skip processing the imported module
entirely, which I tried to break in #1737.
  • Loading branch information
rwbarton authored Jun 22, 2016
1 parent 184fb28 commit d379a93
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test-data/unit/check-ignore.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ from xyz_m import * # type: ignore
x # E: Name 'x' is not defined
1() # E: "int" not callable

[case testIgnoreImportBadModule]
import m # type: ignore
from m import a # type: ignore
[file m.py]
+ # A parse error, but we shouldn't even parse m.py
[out]

[case testIgnoreImportStarFromBadModule]
from m import * # type: ignore
[file m.py]
+
[out]
main:1: note: In module imported here:
tmp/m.py:1: error: Parse error before end of line

[case testIgnoreAssignmentTypeError]
x = 1
x = '' # type: ignore
Expand Down

0 comments on commit d379a93

Please sign in to comment.