Ejemplo n.º 1
0
 def test_handling_nested_modules(self):
     pkg = create_package(self.project, 'xkg')
     mod = create_module(self.project, 'xkg.xod')  # noqa
     self.project.do(FixModuleNames(self.project).get_changes(_fixer))
     self.assertFalse(pkg.exists())
     self.assertTrue(self.project.get_resource('_kg/__init__.py').exists())
     self.assertTrue(self.project.get_resource('_kg/_od.py').exists())
Ejemplo n.º 2
0
 def test_fixing_contents(self):
     mod1 = create_module(self.project, 'xod1')
     mod2 = create_module(self.project, 'xod2')
     mod1.write('import xod2\n')
     mod2.write('import xod1\n')
     self.project.do(FixModuleNames(self.project).get_changes(_fixer))
     newmod1 = self.project.get_resource('_od1.py')
     newmod2 = self.project.get_resource('_od2.py')
     self.assertEquals('import _od2\n', newmod1.read())
     self.assertEquals('import _od1\n', newmod2.read())
Ejemplo n.º 3
0
 def test_fixing_contents(self):
     mod1 = create_module(self.project, "xod1")
     mod2 = create_module(self.project, "xod2")
     mod1.write("import xod2\n")
     mod2.write("import xod1\n")
     self.project.do(FixModuleNames(self.project).get_changes(_fixer))
     newmod1 = self.project.get_resource("_od1.py")
     newmod2 = self.project.get_resource("_od2.py")
     self.assertEqual("import _od2\n", newmod1.read())
     self.assertEqual("import _od1\n", newmod2.read())
Ejemplo n.º 4
0
 def test_packages_module_renaming(self):
     pkg = create_package(self.project, 'xkg')
     self.project.do(FixModuleNames(self.project).get_changes(_fixer))
     self.assertFalse(pkg.exists())
     self.assertTrue(self.project.get_resource('_kg/__init__.py').exists())
Ejemplo n.º 5
0
 def test_simple_module_renaming(self):
     mod = create_module(self.project, 'xod')
     self.project.do(FixModuleNames(self.project).get_changes(_fixer))
     self.assertFalse(mod.exists())
     self.assertTrue(self.project.get_resource('_od.py').exists())