summaryrefslogtreecommitdiffstats
path: root/Doc/library/test.rst
diff options
context:
space:
mode:
authorJoannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>2019-09-12 09:02:59 (GMT)
committerStéphane Wirtel <stephane@wirtel.be>2019-09-12 09:02:59 (GMT)
commit92777d5e5aed1753bafe07265dbe98b2d271815b (patch)
treea609553e4f137751da0e2624372e9b96e4f79d4e /Doc/library/test.rst
parenta06d683d7fd88721eaf59abcf5b02eb82045c7b1 (diff)
downloadcpython-92777d5e5aed1753bafe07265dbe98b2d271815b.zip
cpython-92777d5e5aed1753bafe07265dbe98b2d271815b.tar.gz
cpython-92777d5e5aed1753bafe07265dbe98b2d271815b.tar.bz2
bpo-18578: Rename and document test.bytecode_helper as test.support.bytecode_helper (GH-15168)
Rename and document test.bytecode_helper as test.support.bytecode_helper
Diffstat (limited to 'Doc/library/test.rst')
-rw-r--r--Doc/library/test.rst30
1 files changed, 30 insertions, 0 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst
index 6eef5c6..5dde55c 100644
--- a/Doc/library/test.rst
+++ b/Doc/library/test.rst
@@ -1503,3 +1503,33 @@ script execution tests.
containing the *source*. If *compiled* is ``True``, both source files will
be compiled and added to the zip package. Return a tuple of the full zip
path and the archive name for the zip file.
+
+
+:mod:`test.support.bytecode_helper` --- Support tools for testing correct bytecode generation
+=============================================================================================
+
+.. module:: test.support.bytecode_helper
+ :synopsis: Support tools for testing correct bytecode generation.
+
+The :mod:`test.support.bytecode_helper` module provides support for testing
+and inspecting bytecode generation.
+
+The module defines the follwing class:
+
+.. class:: BytecodeTestCase(unittest.TestCase)
+
+ This class has custom assertion methods for inspecting bytecode.
+
+.. method:: BytecodeTestCase.get_disassembly_as_string(co)
+
+ Return the disassembly of *co* as string.
+
+
+.. method:: BytecodeTestCase.assertInBytecode(x, opname, argval=_UNSPECIFIED)
+
+ Return instr if *opname* is found, otherwise throws :exc:`AssertionError`.
+
+
+.. method:: BytecodeTestCase.assertNotInBytecode(x, opname, argval=_UNSPECIFIED)
+
+ Throws :exc:`AssertionError` if *opname* is found.