MCPcopy Index your code
hub / github.com/python/cpython / test_reverse_import_mapping

Method test_reverse_import_mapping

Lib/test/test_pickle.py:675–693  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

673 self.assertEqual(getattribute(module, name), attr)
674
675 def test_reverse_import_mapping(self):
676 for module2, module3 in IMPORT_MAPPING.items():
677 with self.subTest((module2, module3)):
678 try:
679 getmodule(module3)
680 except ImportError as exc:
681 if support.verbose:
682 print(exc)
683 if ((module2, module3) not in ALT_IMPORT_MAPPING and
684 REVERSE_IMPORT_MAPPING.get(module3, None) != module2):
685 for (m3, n3), (m2, n2) in REVERSE_NAME_MAPPING.items():
686 if (module3, module2) == (m3, m2):
687 break
688 else:
689 self.fail('No reverse mapping from %r to %r' %
690 (module3, module2))
691 module = REVERSE_IMPORT_MAPPING.get(module3, module3)
692 module = IMPORT_MAPPING.get(module, module)
693 self.assertEqual(module, module3)
694
695 def test_reverse_name_mapping(self):
696 for (module2, name2), (module3, name3) in NAME_MAPPING.items():

Callers

nothing calls this directly

Calls 6

getmoduleFunction · 0.70
itemsMethod · 0.45
subTestMethod · 0.45
getMethod · 0.45
failMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected