Skip to content

Commit a5b05c0

Browse files
committed
add test case for expected failure
1 parent a0ba51f commit a5b05c0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,17 +2365,20 @@ def testfunc(n):
23652365
def test_store_subscr_int(self):
23662366
def testfunc(args):
23672367
n = args[0]
2368-
l = [0] * n
2369-
ret = 0
2370-
for idx in range(n):
2371-
l[idx] = idx
2368+
l = [0, 0, 0, 0]
2369+
for _ in range(n):
2370+
l[0] = 1
2371+
l[1] = 2
2372+
l[2] = 3
2373+
l[3] = 4
23722374
return sum(l)
23732375

23742376
res, ex = self._run_with_optimizer(testfunc, (TIER2_THRESHOLD,))
2375-
self.assertEqual(res, sum(range(TIER2_THRESHOLD)))
2377+
self.assertEqual(res, 10)
23762378
self.assertIsNotNone(ex)
23772379
uops = get_opnames(ex)
2378-
self.assertIn("_POP_TOP_INT", uops)
2380+
self.assertIn("_POP_TOP_NOP", uops)
2381+
self.assertNotIn("_POP_TOP_INT", uops)
23792382

23802383
def test_attr_promotion_failure(self):
23812384
# We're not testing for any specific uops here, just

0 commit comments

Comments
 (0)