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

Method test_module

Lib/test/test_importlib/frozen/test_finder.py:70–110  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

68 self.assertListEqual(spec.submodule_search_locations, expected)
69
70 def test_module(self):
71 modules = [
72 '__hello__',
73 '__phello__.spam',
74 '__phello__.ham.eggs',
75 ]
76 for name in modules:
77 with self.subTest(f'{name} -> {name}'):
78 spec = self.find(name)
79 self.check_basic(spec, name)
80 self.check_loader_state(spec)
81 modules = {
82 '__hello_alias__': '__hello__',
83 '_frozen_importlib': 'importlib._bootstrap',
84 }
85 for name, origname in modules.items():
86 with self.subTest(f'{name} -> {origname}'):
87 spec = self.find(name)
88 self.check_basic(spec, name)
89 self.check_loader_state(spec, origname)
90 modules = [
91 '__phello__.__init__',
92 '__phello__.ham.__init__',
93 ]
94 for name in modules:
95 origname = '<' + name.rpartition('.')[0]
96 filename = resolve_stdlib_file(name)
97 with self.subTest(f'{name} -> {origname}'):
98 spec = self.find(name)
99 self.check_basic(spec, name)
100 self.check_loader_state(spec, origname, filename)
101 modules = {
102 '__hello_only__': ('Tools', 'freeze', 'flag.py'),
103 }
104 for name, path in modules.items():
105 origname = None
106 filename = os.path.join(REPO_ROOT, *path)
107 with self.subTest(f'{name} -> {filename}'):
108 spec = self.find(name)
109 self.check_basic(spec, name)
110 self.check_loader_state(spec, origname, filename)
111
112 def test_package(self):
113 packages = [

Callers

nothing calls this directly

Calls 8

findMethod · 0.95
check_basicMethod · 0.95
check_loader_stateMethod · 0.95
resolve_stdlib_fileFunction · 0.70
subTestMethod · 0.45
itemsMethod · 0.45
rpartitionMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected