Throws AssertionError if opname is found
(self, x, opname, argval=_UNSPECIFIED)
| 47 | self.fail(msg) |
| 48 | |
| 49 | def assertNotInBytecode(self, x, opname, argval=_UNSPECIFIED): |
| 50 | """Throws AssertionError if opname is found""" |
| 51 | self.assertIn(opname, dis.opmap) |
| 52 | for instr in dis.get_instructions(x): |
| 53 | if instr.opname == opname: |
| 54 | disassembly = self.get_disassembly_as_string(x) |
| 55 | if argval is _UNSPECIFIED: |
| 56 | msg = '%s occurs in bytecode:\n%s' % (opname, disassembly) |
| 57 | self.fail(msg) |
| 58 | elif instr.argval == argval: |
| 59 | msg = '(%s,%r) occurs in bytecode:\n%s' |
| 60 | msg = msg % (opname, argval, disassembly) |
| 61 | self.fail(msg) |
| 62 | |
| 63 | class CompilationStepTestCase(unittest.TestCase): |
| 64 |