Skip to content

Commit e46573d

Browse files
author
Guido van Rossum
committed
Add simple tests.
These verify that deferral due to a cross-module dependency works.
1 parent 8cfe16b commit e46573d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test-data/unit/check-modules.test

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,33 @@ reveal_type(x)
11751175
main:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
11761176
main:2: error: Revealed type is 'builtins.str'
11771177

1178+
[case testSymmetricImportCycle1]
1179+
import a
1180+
[file a.py]
1181+
import b
1182+
def f() -> int:
1183+
return b.x
1184+
y = 0 + 0
1185+
[file b.py]
1186+
import a
1187+
def g() -> int:
1188+
return a.y
1189+
x = 1 + 1
1190+
1191+
[case testSymmetricImportCycle2]
1192+
import b
1193+
[file a.py]
1194+
import b
1195+
def f() -> int:
1196+
return b.x
1197+
y = 0 + 0
1198+
[file b.py]
1199+
import a
1200+
def g() -> int:
1201+
return a.y
1202+
x = 1 + 1
1203+
1204+
11781205
-- Scripts and __main__
11791206

11801207
[case testScriptsAreModules]
@@ -1191,3 +1218,4 @@ pass
11911218
[file b]
11921219
pass
11931220
[out]
1221+

0 commit comments

Comments
 (0)