Skip to content

Commit 2c0943b

Browse files
committed
add more tests
1 parent 694a5fd commit 2c0943b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Lib/test/test_peepholer.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,33 @@ def test_fold_constant_intrinsic_list_to_tuple(self):
14141414
]
14151415
self.cfg_optimization_test(before, after, consts=[], expected_consts=[(1, 2, 3)])
14161416

1417+
# NOP's in between: (1, 2, 3)
1418+
before = [
1419+
('BUILD_LIST', 0, 0),
1420+
('NOP', None, 0),
1421+
('LOAD_SMALL_INT', 1, 0),
1422+
('NOP', None, 0),
1423+
('NOP', None, 0),
1424+
('LIST_APPEND', 1, 0),
1425+
('NOP', None, 0),
1426+
('LOAD_SMALL_INT', 2, 0),
1427+
('NOP', None, 0),
1428+
('NOP', None, 0),
1429+
('LIST_APPEND', 1, 0),
1430+
('NOP', None, 0),
1431+
('LOAD_SMALL_INT', 3, 0),
1432+
('NOP', None, 0),
1433+
('LIST_APPEND', 1, 0),
1434+
('NOP', None, 0),
1435+
('CALL_INTRINSIC_1', INTRINSIC_LIST_TO_TUPLE, 0),
1436+
('RETURN_VALUE', None, 0)
1437+
]
1438+
after = [
1439+
('LOAD_CONST', 0, 0),
1440+
('RETURN_VALUE', None, 0)
1441+
]
1442+
self.cfg_optimization_test(before, after, consts=[], expected_consts=[(1, 2, 3)])
1443+
14171444
def test_optimize_if_const_list(self):
14181445
before = [
14191446
('NOP', None, 0),

0 commit comments

Comments
 (0)