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

Method testBadMagic

Lib/test/test_zipimport.py:274–280  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

272 self.doTest(None, files, TESTMOD)
273
274 def testBadMagic(self):
275 # make pyc magic word invalid, forcing loading from .py
276 badmagic_pyc = bytearray(test_pyc)
277 badmagic_pyc[0] ^= 0x04 # flip an arbitrary bit
278 files = {TESTMOD + ".py": test_src,
279 TESTMOD + pyc_ext: badmagic_pyc}
280 self.doTest(".py", files, TESTMOD)
281
282 def testBadMagic2(self):
283 # make pyc magic word invalid, causing an ImportError

Callers

nothing calls this directly

Calls 1

doTestMethod · 0.95

Tested by

no test coverage detected