classification
Title: Update doc strings for test.bytecode_helper
Type: Stage:
Components: Documentation Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, nanjekyejoannah
Priority: normal Keywords:

Created on 2019-08-07 19:22 by nanjekyejoannah, last changed 2019-08-07 19:22 by nanjekyejoannah.

Messages (2)
msg349193 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-08-07 19:22
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.
msg349194 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-08-07 19:22
*supposed not supported.
History
Date User Action Args
2019-08-07 19:22:55nanjekyejoannahsetmessages: + msg349194
2019-08-07 19:22:23nanjekyejoannahsetassignee: docs@python

nosy: + docs@python
components: + Documentation
versions: + Python 3.9
2019-08-07 19:22:07nanjekyejoannahcreate