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

Method test_for_iter_range

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

Source from the content-addressed store, hash-verified

372 self.assertIn("_BINARY_OP_ADD_INT", uops)
373
374 def test_for_iter_range(self):
375 def testfunc(n):
376 total = 0
377 for i in range(n):
378 total += i
379 return total
380
381 total = testfunc(TIER2_THRESHOLD)
382 self.assertEqual(total, sum(range(TIER2_THRESHOLD)))
383
384 ex = get_first_executor(testfunc)
385 self.assertIsNotNone(ex)
386 # for i, (opname, oparg) in enumerate(ex):
387 # print(f"{i:4d}: {opname:<20s} {oparg:3d}")
388 uops = get_opnames(ex)
389 self.assertIn("_GUARD_NOT_EXHAUSTED_RANGE", uops)
390 # Verification that the jump goes past END_FOR
391 # is done by manual inspection of the output
392
393 def test_for_iter_list(self):
394 def testfunc(a):

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