Skip to content

Commit cd92614

Browse files
committed
update tests
1 parent 578d66b commit cd92614

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Lib/test/test_peepholer.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,34 @@ def test_conditional_jump_forward_non_const_condition(self):
10681068
consts=[0, 1, 2, 3, 4],
10691069
expected_consts=[0, 2, 3])
10701070

1071+
def test_build_list_stack_use_guideline(self):
1072+
def f():
1073+
return [
1074+
0, 1, 2, 3, 4,
1075+
5, 6, 7, 8, 9,
1076+
10, 11, 12, 13, 14,
1077+
15, 16, 17, 18, 19,
1078+
20, 21, 22, 23, 24,
1079+
25, 26, 27, 28, 29,
1080+
30, 31, 32, 33, 34,
1081+
35, 36, 37, 38, 39
1082+
]
1083+
self.assertEqual(f(), list(range(40)))
1084+
1085+
def test_build_set_stack_use_guideline(self):
1086+
def f():
1087+
return {
1088+
0, 1, 2, 3, 4,
1089+
5, 6, 7, 8, 9,
1090+
10, 11, 12, 13, 14,
1091+
15, 16, 17, 18, 19,
1092+
20, 21, 22, 23, 24,
1093+
25, 26, 27, 28, 29,
1094+
30, 31, 32, 33, 34,
1095+
35, 36, 37, 38, 39
1096+
}
1097+
self.assertEqual(f(), frozenset(range(40)))
1098+
10711099
def test_multiple_foldings(self):
10721100
before = [
10731101
('LOAD_SMALL_INT', 1, 0),

0 commit comments

Comments
 (0)