Skip to content

Commit 1f82a0d

Browse files
committed
Update test_dis.py
1 parent d5ce21b commit 1f82a0d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Lib/test/test_dis.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -1029,28 +1029,31 @@ def expected(count, w):
10291029
s = ['''\
10301030
1 %*d RESUME 0
10311031
1032+
''' % (w, 0)]
1033+
s += ['''\
10321034
2 %*d LOAD_FAST 0 (x)
10331035
%*d LOAD_CONST 1 (1)
10341036
%*d BINARY_OP 0 (+)
1035-
''' % (w, 0, w, 2, w, 4, w, 6)]
1037+
''' % (w, 2, w, 4, w, 6)]
10361038
s += ['''\
1037-
%*d STORE_FAST_LOAD_FAST 0 (x, x)
1039+
%*d POP_TOP
1040+
%*d LOAD_FAST 0 (x)
10381041
%*d LOAD_CONST 1 (1)
10391042
%*d BINARY_OP 0 (+)
1040-
''' % (w, 8*i + 10, w, 8*i + 12, w, 8*i + 14)
1041-
for i in range(count-1)]
1043+
''' % (w, 10*(i+1), w, 10*(i+1) + 2, w, 10*(i+1) + 4, w, 10*(i+1) + 6)
1044+
for i in range(count-1)]
10421045
s += ['''\
10431046
%*d STORE_FAST 0 (x)
10441047
10451048
3 %*d LOAD_FAST 0 (x)
10461049
%*d RETURN_VALUE
1047-
''' % (w, 8*count + 2, w, 8*count + 4, w, 8*count + 6)]
1050+
''' % (w, 10*count, w, 10*count + 2, w, 10*count + 4)]
10481051
return ''.join(s)
10491052

10501053
for i in range(1, 5):
10511054
self.do_disassembly_test(func(i), expected(i, 4), True)
1052-
self.do_disassembly_test(func(1200), expected(1200, 4), True)
1053-
self.do_disassembly_test(func(1300), expected(1300, 5), True)
1055+
self.do_disassembly_test(func(999), expected(999, 4), True)
1056+
self.do_disassembly_test(func(1000), expected(1000, 5), True)
10541057

10551058
def test_disassemble_str(self):
10561059
self.do_disassembly_test(expr_str, dis_expr_str)

0 commit comments

Comments
 (0)