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

Method check_import_loaded_module

Lib/test/test_capi/test_import.py:32–39  ·  view source on GitHub ↗
(self, import_module)

Source from the content-addressed store, hash-verified

30 self.assertIs(modules, sys.modules)
31
32 def check_import_loaded_module(self, import_module):
33 for name in ('os', 'sys', 'test', 'unittest'):
34 with self.subTest(name=name):
35 self.assertIn(name, sys.modules)
36 old_module = sys.modules[name]
37 module = import_module(name)
38 self.assertIsInstance(module, types.ModuleType)
39 self.assertIs(module, old_module)
40
41 def check_import_fresh_module(self, import_module):
42 old_modules = dict(sys.modules)

Callers 3

test_getmoduleMethod · 0.95
check_addmoduleMethod · 0.95
check_import_funcMethod · 0.95

Calls 5

assertInMethod · 0.80
assertIsInstanceMethod · 0.80
import_moduleFunction · 0.50
subTestMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected