summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_peepholer.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-01-14 10:12:45 (GMT)
committerGitHub <noreply@github.com>2020-01-14 10:12:45 (GMT)
commit9af0e47b1705457bb6b327c197f2ec5737a1d8f6 (patch)
tree97378eee78d793d16bd19038d88371d776e720c3 /Lib/test/test_peepholer.py
parent62e3973395fb9fab2eb8f651bcd0fea4e695e1cf (diff)
downloadcpython-9af0e47b1705457bb6b327c197f2ec5737a1d8f6.zip
cpython-9af0e47b1705457bb6b327c197f2ec5737a1d8f6.tar.gz
cpython-9af0e47b1705457bb6b327c197f2ec5737a1d8f6.tar.bz2
bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)
Break up COMPARE_OP into four logically distinct opcodes: * COMPARE_OP for rich comparisons * IS_OP for 'is' and 'is not' tests * CONTAINS_OP for 'in' and 'is not' tests * JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.
Diffstat (limited to 'Lib/test/test_peepholer.py')
-rw-r--r--Lib/test/test_peepholer.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py
index 23cc36c..567e6a1 100644
--- a/Lib/test/test_peepholer.py
+++ b/Lib/test/test_peepholer.py
@@ -65,14 +65,14 @@ class TestTranforms(BytecodeTestCase):
self.check_lnotab(unot)
def test_elim_inversion_of_is_or_in(self):
- for line, cmp_op in (
- ('not a is b', 'is not',),
- ('not a in b', 'not in',),
- ('not a is not b', 'is',),
- ('not a not in b', 'in',),
+ for line, cmp_op, invert in (
+ ('not a is b', 'IS_OP', 1,),
+ ('not a is not b', 'IS_OP', 0,),
+ ('not a in b', 'CONTAINS_OP', 1,),
+ ('not a not in b', 'CONTAINS_OP', 0,),
):
code = compile(line, '', 'single')
- self.assertInBytecode(code, 'COMPARE_OP', cmp_op)
+ self.assertInBytecode(code, cmp_op, invert)
self.check_lnotab(code)
def test_global_as_constant(self):