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

Method test_reload_loader_replaced

Lib/test/test_importlib/test_api.py:215–224  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

213 self.assertEqual(reloaded.__loader__.path, loader.path)
214
215 def test_reload_loader_replaced(self):
216 with import_helper.CleanImport('types'):
217 import types
218 types.__loader__ = None
219 self.init.invalidate_caches()
220 reloaded = self.init.reload(types)
221
222 self.assertIsNot(reloaded.__loader__, None)
223 self.assertIs(reloaded, types)
224 self.assertIs(sys.modules['types'], types)
225
226 def test_reload_location_changed(self):
227 name = 'spam'

Callers

nothing calls this directly

Calls 4

assertIsNotMethod · 0.80
invalidate_cachesMethod · 0.45
reloadMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected