MCPcopy Index your code
hub / github.com/python/cpython / test_for_iter_list

Method test_for_iter_list

Lib/test/test_capi/test_opt.py:393–411  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

391 # is done by manual inspection of the output
392
393 def test_for_iter_list(self):
394 def testfunc(a):
395 total = 0
396 for i in a:
397 total += i
398 return total
399
400 a = list(range(TIER2_THRESHOLD))
401 total = testfunc(a)
402 self.assertEqual(total, sum(a))
403
404 ex = get_first_executor(testfunc)
405 self.assertIsNotNone(ex)
406 # for i, (opname, oparg) in enumerate(ex):
407 # print(f"{i:4d}: {opname:<20s} {oparg:3d}")
408 uops = get_opnames(ex)
409 self.assertIn("_GUARD_NOT_EXHAUSTED_LIST", uops)
410 # Verification that the jump goes past END_FOR
411 # is done by manual inspection of the output
412
413 def test_for_iter_tuple(self):
414 def testfunc(a):

Callers

nothing calls this directly

Calls 7

listClass · 0.85
testfuncFunction · 0.85
get_first_executorFunction · 0.85
get_opnamesFunction · 0.85
assertIsNotNoneMethod · 0.80
assertInMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected