Skip to content

Commit a12fd2e

Browse files
committed
update test
1 parent f761f0b commit a12fd2e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_peepholer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import dis
22
from itertools import combinations, product
3+
import opcode
34
import sys
45
import textwrap
56
import unittest
@@ -517,13 +518,15 @@ def test_folding_subscript(self):
517518
('("a" * 10)[10]', True),
518519
('(1, (1, 2))[2:6][0][2-1]', True),
519520
]
521+
subscr_argval = 26
522+
assert opcode._nb_ops[subscr_argval][0] == 'NB_SUBSCR'
520523
for expr, has_error in tests:
521524
with self.subTest(expr=expr, has_error=has_error):
522525
code = compile(expr, '', 'single')
523526
if not has_error:
524-
self.assertNotInBytecode(code, 'BINARY_SUBSCR')
527+
self.assertNotInBytecode(code, 'BINARY_OP', argval=subscr_argval)
525528
else:
526-
self.assertInBytecode(code, 'BINARY_SUBSCR')
529+
self.assertInBytecode(code, 'BINARY_OP', argval=subscr_argval)
527530
self.check_lnotab(code)
528531

529532
def test_in_literal_list(self):

0 commit comments

Comments
 (0)