def test__module_object(self): filename = os.path.join(root_path(), 'applications/app1/tests/test_module_a.py' ) test_file = File(filename, root_path()) test_file.parse() expect = Module(os.path.join(root_path(), 'applications/app1/modules/module_a.py'), root_path()) self.assertEqual(test_file.module_object(), expect) return
def test__relative_module(self): filename = os.path.join(root_path(), 'applications/app1/tests/test_module_a.py' ) test_file = File(filename, root_path()) test_file.parse() expect = 'applications.app1.tests.test_module_a' self.assertEqual(test_file.relative_module(), expect) # Test parse with script with sub directory filename = os.path.join(root_path(), 'applications/app2/tests/adir/test_module_d.py' ) test_file = File(filename, root_path()) test_file.parse() expect = 'applications.app2.tests.adir.test_module_d' self.assertEqual(test_file.relative_module(), expect) return
def test__import_line(self): filename = os.path.join(root_path(), 'applications/app1/tests/test_module_a.py' ) test_file = File(filename, root_path()) test_file.parse() expect = \ 'from applications.app1.modules.module_a import ClassA, ClassAA' self.assertEqual(test_file.import_line(), expect) # Test parse with script with sub directory filename = os.path.join(root_path(), 'applications/app2/tests/adir/test_module_d.py' ) test_file = File(filename, root_path()) test_file.parse() expect = \ 'from applications.app2.modules.adir.module_d import ClassD' self.assertEqual(test_file.import_line(), expect) return
def test__module_file(self): filename = os.path.join(root_path(), 'applications/app1/tests/test_module_a.py' ) test_file = File(filename, root_path()) test_file.parse() expect = os.path.join(root_path(), 'applications/app1/modules/module_a.py') self.assertEqual(test_file.module_file(), expect) # Test parse with script with sub directory filename = os.path.join(root_path(), 'applications/app2/tests/adir/test_module_d.py' ) test_file = File(filename, root_path()) test_file.parse() expect = os.path.join(root_path(), 'applications/app2/modules/adir/module_d.py' ) self.assertEqual(test_file.module_file(), expect) return
def test__parse(self): filename = os.path.join(root_path(), 'applications/app1/tests/test_module_a.py' ) test_file = File(filename, root_path()) # Test parse with script without sub directory test_file.parse() self.assertEqual(test_file.application, 'app1') self.assertEqual(test_file.sub_directory, '') self.assertEqual(test_file.module, 'module_a') # Test parse with script with sub directory filename = os.path.join(root_path(), 'applications/app2/tests/adir/test_module_d.py' ) test_file = File(filename, root_path()) test_file.parse() self.assertEqual(test_file.application, 'app2') self.assertEqual(test_file.sub_directory, 'adir') self.assertEqual(test_file.module, 'module_d') return