summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-01-16 12:35:21 (GMT)
committerGitHub <noreply@github.com>2023-01-16 12:35:21 (GMT)
commit7b14c2ef194b6eed79670aa9d7e29ab8e2256a56 (patch)
tree794188d49a9f359cfa7663c25be587634f070f22 /Lib/test/test_compile.py
parentb1a74a182d8762bda51838401ac92b6ebad9632a (diff)
downloadcpython-7b14c2ef194b6eed79670aa9d7e29ab8e2256a56.zip
cpython-7b14c2ef194b6eed79670aa9d7e29ab8e2256a56.tar.gz
cpython-7b14c2ef194b6eed79670aa9d7e29ab8e2256a56.tar.bz2
GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index f74d2ed..1606c9c 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -1121,11 +1121,11 @@ if 1:
check_op_count(aug, "BUILD_SLICE", 0)
def test_compare_positions(self):
- for opname, op in [
- ("COMPARE_OP", "<"),
- ("COMPARE_OP", "<="),
- ("COMPARE_OP", ">"),
- ("COMPARE_OP", ">="),
+ for opname_prefix, op in [
+ ("COMPARE_", "<"),
+ ("COMPARE_", "<="),
+ ("COMPARE_", ">"),
+ ("COMPARE_", ">="),
("CONTAINS_OP", "in"),
("CONTAINS_OP", "not in"),
("IS_OP", "is"),
@@ -1140,7 +1140,7 @@ if 1:
actual_positions = [
instruction.positions
for instruction in dis.get_instructions(code)
- if instruction.opname == opname
+ if instruction.opname.startswith(opname_prefix)
]
with self.subTest(source):
self.assertEqual(actual_positions, expected_positions)
@@ -1270,7 +1270,7 @@ if (a or
self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE',
line=2, end_line=2, column=15, end_column=16, occurrence=2)
# compare d and 0
- self.assertOpcodeSourcePositionIs(compiled_code, 'COMPARE_OP',
+ self.assertOpcodeSourcePositionIs(compiled_code, 'COMPARE_AND_BRANCH',
line=4, end_line=4, column=8, end_column=13, occurrence=1)
# jump if comparison it True
self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE',