Skip to content

Commit ee74d62

Browse files
committed
test_moving_modules_lazy_imports*: a test variant that still fails
1 parent e42c7b6 commit ee74d62

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ropetest/refactor/movetest.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,26 @@ def import_later():
613613
import pkg2.pkg3.pkg4.mod4""")
614614
self.assertEqual(expected, self.mod1.read())
615615

616+
# The previous test has only one occurrence of "lazy",
617+
# which is inside an import statement. This test
618+
def test_moving_modules_lazy_import_used(self):
619+
pkg2 = testutils.create_package(self.project, "pkg2")
620+
pkg3 = testutils.create_package(self.project, "pkg3", pkg2)
621+
pkg4 = testutils.create_package(self.project, "pkg4", pkg3)
622+
code = dedent("""\
623+
def import_later():
624+
import pkg.mod4
625+
pkg.mod4""")
626+
self.mod1.write(code)
627+
self._move(self.mod4, None, pkg4)
628+
self.assertTrue(self.project.find_module("pkg2.pkg3.pkg4.mod4") is not None)
629+
expected = dedent("""\
630+
def import_later():
631+
import pkg2.pkg3.pkg4.mod4
632+
pkg2.pkg3.pkg4.mod4""")
633+
self.assertEqual(expected, self.mod1.read())
634+
635+
616636
def test_moving_package_with_from_and_normal_imports(self):
617637
pkg2 = testutils.create_package(self.project, "pkg2")
618638
code = dedent("""\

0 commit comments

Comments
 (0)