This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nanjekyejoannah
Recipients nanjekyejoannah
Date 2019-08-07.19:22:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565205727.21.0.329229994167.issue37789@roundup.psfhosted.org>
In-reply-to
Content
I want to believe there is a mistake in the doc strings for these methods:

def assertInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Returns instr if op is found, otherwise throws AssertionError"""
        for instr in dis.get_instructions(x):
            if instr.opname == opname:
                if argval is _UNSPECIFIED or instr.argval == argval:
                    return instr
        disassembly = self.get_disassembly_as_string(x)
        if argval is _UNSPECIFIED:
            msg = '%s not found in bytecode:\n%s' % (opname, disassembly)
        else:
            msg = '(%s,%r) not found in bytecode:\n%s'
            msg = msg % (opname, argval, disassembly)
        self.fail(msg)

    def assertNotInBytecode(self, x, opname, argval=_UNSPECIFIED):
        """Throws AssertionError if op is found"""
        for instr in dis.get_instructions(x):
            if instr.opname == opname:
                disassembly = self.get_disassembly_as_string(x)
                if argval is _UNSPECIFIED:
                    msg = '%s occurs in bytecode:\n%s' % (opname, disassembly)
                elif instr.argval == argval:
                    msg = '(%s,%r) occurs in bytecode:\n%s'
                    msg = msg % (opname, argval, disassembly)
                self.fail(msg)

It is supported to refer to *opname* not *op*. Either the method signatures or the doc strings have to be updated. I stand to be corrected If wrong though.
History
Date User Action Args
2019-08-07 19:22:07nanjekyejoannahsetrecipients: + nanjekyejoannah
2019-08-07 19:22:07nanjekyejoannahsetmessageid: <1565205727.21.0.329229994167.issue37789@roundup.psfhosted.org>
2019-08-07 19:22:07nanjekyejoannahlinkissue37789 messages
2019-08-07 19:22:07nanjekyejoannahcreate