(self)
| 280 | self.doTest(".py", files, TESTMOD) |
| 281 | |
| 282 | def testBadMagic2(self): |
| 283 | # make pyc magic word invalid, causing an ImportError |
| 284 | badmagic_pyc = bytearray(test_pyc) |
| 285 | badmagic_pyc[0] ^= 0x04 # flip an arbitrary bit |
| 286 | files = {TESTMOD + pyc_ext: badmagic_pyc} |
| 287 | try: |
| 288 | self.doTest(".py", files, TESTMOD) |
| 289 | self.fail("This should not be reached") |
| 290 | except zipimport.ZipImportError as exc: |
| 291 | self.assertIsInstance(exc.__cause__, ImportError) |
| 292 | self.assertIn("magic number", exc.__cause__.msg) |
| 293 | |
| 294 | def testBadMTime(self): |
| 295 | badtime_pyc = bytearray(test_pyc) |
nothing calls this directly
no test coverage detected