Skip to content

Commit f6eb00c

Browse files
Improve test
Co-authored-by: Brandt Bucher <[email protected]>
1 parent b821b8b commit f6eb00c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,17 +1648,16 @@ def f(n):
16481648

16491649
def test_binary_subcsr_str_int_narrows_to_str(self):
16501650
def testfunc(n):
1651-
x = 0
1651+
x = []
16521652
s = "foo"
1653-
z = ""
16541653
for _ in range(n):
16551654
y = s[0] # _BINARY_OP_SUBSCR_STR_INT
16561655
z = "bar" + y # (_GUARD_TOS_UNICODE) + _BINARY_OP_ADD_UNICODE
1657-
x += 1
1656+
x.append(z)
16581657
return x
16591658

16601659
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
1661-
self.assertEqual(res, TIER2_THRESHOLD)
1660+
self.assertEqual(res, ["barf"] * TIER2_THRESHOLD)
16621661
self.assertIsNotNone(ex)
16631662
uops = get_opnames(ex)
16641663
self.assertIn("_BINARY_OP_SUBSCR_STR_INT", uops)

0 commit comments

Comments
 (0)