Skip to content

Commit 571d930

Browse files
author
Guido van Rossum
committed
Change import test to use locals too
1 parent 9b00e73 commit 571d930

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

test-data/unit/check-inference.test

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,21 +2351,31 @@ def bar() -> None:
23512351
[case testUnusedTargetNotImport]
23522352
import d, c, b, a
23532353
[file _.py]
2354+
def f(): pass
23542355
[file m.py]
23552356
def f(): pass
2356-
def _(): pass
2357+
_ = f
2358+
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type "Callable[[], Any]")
23572359
[file a.py]
2358-
import _
2359-
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type Module)
2360+
def foo() -> None:
2361+
import _
2362+
_.f()
2363+
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type Module)
23602364
[file b.py]
2361-
import m as _
2362-
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type Module)
2365+
def foo() -> None:
2366+
import m as _
2367+
_.f()
2368+
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type Module)
23632369
[file c.py]
2364-
from m import _
2365-
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type "Callable[[], Any]")
2370+
def foo() -> None:
2371+
from m import _
2372+
_()
2373+
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type "Callable[[], Any]")
23662374
[file d.py]
2367-
from m import f as _
2368-
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type "Callable[[], Any]")
2375+
def foo() -> None:
2376+
from m import f as _
2377+
_()
2378+
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type "Callable[[], Any]")
23692379
[builtins fixtures/module.pyi]
23702380

23712381
[case testUnusedTargetNotClass]

0 commit comments

Comments
 (0)