Skip to content

Commit

Permalink
test_moving_modules_lazy_imports*: a test variant that still fails
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneSerge committed Nov 9, 2023
1 parent e42c7b6 commit ee74d62
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ropetest/refactor/movetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,26 @@ def import_later():
import pkg2.pkg3.pkg4.mod4""")
self.assertEqual(expected, self.mod1.read())

# The previous test has only one occurrence of "lazy",
# which is inside an import statement. This test
def test_moving_modules_lazy_import_used(self):
pkg2 = testutils.create_package(self.project, "pkg2")
pkg3 = testutils.create_package(self.project, "pkg3", pkg2)
pkg4 = testutils.create_package(self.project, "pkg4", pkg3)
code = dedent("""\
def import_later():
import pkg.mod4
pkg.mod4""")
self.mod1.write(code)
self._move(self.mod4, None, pkg4)
self.assertTrue(self.project.find_module("pkg2.pkg3.pkg4.mod4") is not None)
expected = dedent("""\
def import_later():
import pkg2.pkg3.pkg4.mod4
pkg2.pkg3.pkg4.mod4""")
self.assertEqual(expected, self.mod1.read())


def test_moving_package_with_from_and_normal_imports(self):
pkg2 = testutils.create_package(self.project, "pkg2")
code = dedent("""\
Expand Down

0 comments on commit ee74d62

Please sign in to comment.