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

Method test_for_iter_tuple

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

Source from the content-addressed store, hash-verified

411 # is done by manual inspection of the output
412
413 def test_for_iter_tuple(self):
414 def testfunc(a):
415 total = 0
416 for i in a:
417 total += i
418 return total
419
420 a = tuple(range(TIER2_THRESHOLD))
421 total = testfunc(a)
422 self.assertEqual(total, sum(a))
423
424 ex = get_first_executor(testfunc)
425 self.assertIsNotNone(ex)
426 # for i, (opname, oparg) in enumerate(ex):
427 # print(f"{i:4d}: {opname:<20s} {oparg:3d}")
428 uops = get_opnames(ex)
429 self.assertIn("_GUARD_NOT_EXHAUSTED_TUPLE", uops)
430 # Verification that the jump goes past END_FOR
431 # is done by manual inspection of the output
432
433 def test_list_edge_case(self):
434 def testfunc(it):

Callers

nothing calls this directly

Calls 6

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