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

Method test_call_len_string

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

Source from the content-addressed store, hash-verified

2636 self.assertIn("_POP_TOP_NOP", uops)
2637
2638 def test_call_len_string(self):
2639 def testfunc(n):
2640 for _ in range(n):
2641 _ = len("abc")
2642 d = ''
2643 _ = len(d)
2644 _ = len(b"def")
2645 _ = len(b"")
2646
2647 _, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
2648 self.assertIsNotNone(ex)
2649 uops = get_opnames(ex)
2650 self.assertNotIn("_CALL_LEN", uops)
2651 self.assertEqual(count_ops(ex, "_SHUFFLE_3_LOAD_CONST_INLINE_BORROW"), 4)
2652
2653 def test_call_len_known_length_small_int(self):
2654 # Make sure that len(t) is optimized for a tuple of length 5.

Callers

nothing calls this directly

Calls 6

_run_with_optimizerMethod · 0.95
get_opnamesFunction · 0.85
count_opsFunction · 0.85
assertIsNotNoneMethod · 0.80
assertNotInMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected