Skip to content

Commit d2e98d7

Browse files
committed
shift test function up
1 parent e6a0f2a commit d2e98d7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,21 +2030,6 @@ def f(n):
20302030
self.assertNotIn("_GUARD_NOS_TUPLE", uops)
20312031
self.assertIn("_BINARY_OP_SUBSCR_TUPLE_INT", uops)
20322032

2033-
def test_remove_guard_for_tuple_bounds_check(self):
2034-
def f(n):
2035-
x = 0
2036-
for _ in range(n):
2037-
t = (1, 2, 3)
2038-
x += t[0]
2039-
return x
2040-
2041-
res, ex = self._run_with_optimizer(f, TIER2_THRESHOLD)
2042-
self.assertEqual(res, TIER2_THRESHOLD)
2043-
self.assertIsNotNone(ex)
2044-
uops = get_opnames(ex)
2045-
self.assertNotIn("_GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS", uops)
2046-
self.assertIn("_BINARY_OP_SUBSCR_TUPLE_INT", uops)
2047-
20482033
def test_remove_guard_for_known_type_slice(self):
20492034
def f(n):
20502035
x = 0
@@ -2062,6 +2047,21 @@ def f(n):
20622047
self.assertEqual(count, 1)
20632048
self.assertIn("_BINARY_OP_SUBSCR_LIST_INT", uops)
20642049

2050+
def test_remove_guard_for_tuple_bounds_check(self):
2051+
def f(n):
2052+
x = 0
2053+
for _ in range(n):
2054+
t = (1, 2, 3)
2055+
x += t[0]
2056+
return x
2057+
2058+
res, ex = self._run_with_optimizer(f, TIER2_THRESHOLD)
2059+
self.assertEqual(res, TIER2_THRESHOLD)
2060+
self.assertIsNotNone(ex)
2061+
uops = get_opnames(ex)
2062+
self.assertNotIn("_GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS", uops)
2063+
self.assertIn("_BINARY_OP_SUBSCR_TUPLE_INT", uops)
2064+
20652065
def test_binary_subcsr_str_int_narrows_to_str(self):
20662066
def testfunc(n):
20672067
x = []

0 commit comments

Comments
 (0)