Skip to content

Commit 4de291e

Browse files
committed
Add test case
1 parent 3664bca commit 4de291e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mypy/test/data/check-modules.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,16 @@ except:
522522
def f(x): pass
523523
def g(x, y): pass
524524

525+
[case testImportedVariableViaImport]
526+
try:
527+
from m import x
528+
except:
529+
from n import x # E: Incompatible import of "x" (imported name has type "str", local name has type "int")
530+
[file m.py]
531+
x = 1
532+
[file n.py]
533+
x = ''
534+
525535

526536
-- Test cases that simulate 'mypy -m modname'
527537
--

0 commit comments

Comments
 (0)