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.

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

Created on 2019-08-07 19:22 by nanjekyejoannah, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
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.
msg415626 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-20 18:28
This has been fixed by now.
History
Date User Action Args
2022-04-11 14:59:18adminsetgithub: 81970
2022-03-20 18:28:34iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg415626

resolution: out of date
stage: resolved
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