def test_import(self): modules = set(IMPORT_MAPPING.values()) modules |= set(REVERSE_IMPORT_MAPPING) modules |= {module for module, name in REVERSE_NAME_MAPPING} modules |= {module for module, name in NAME_MAPPING.values()} for module in modules: try: getmodule(module) except ImportError: pass
def test_reverse_name_mapping(self): for (module2, name2), (module3, name3) in NAME_MAPPING.items(): with self.subTest(((module2, name2), (module3, name3))): try: attr = getattribute(module3, name3) except ImportError: pass module, name = reverse_mapping(module3, name3) if (module2, name2, module3, name3) not in ALT_NAME_MAPPING: self.assertEqual((module, name), (module2, name2)) module, name = mapping(module, name) self.assertEqual((module, name), (module3, name3))