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

Method assertNotInBytecode

Lib/test/support/bytecode_helper.py:49–61  ·  view source on GitHub ↗

Throws AssertionError if opname is found

(self, x, opname, argval=_UNSPECIFIED)

Source from the content-addressed store, hash-verified

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
63class CompilationStepTestCase(unittest.TestCase):
64

Calls 4

assertInMethod · 0.80
get_instructionsMethod · 0.80
failMethod · 0.45