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

Method test_contains_op

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

Source from the content-addressed store, hash-verified

2362 self.assertNotIn("_STORE_SUBSCR_DICT", uops)
2363
2364 def test_contains_op(self):
2365 def testfunc(n):
2366 x = 0
2367 items = [1, 2, 3]
2368 for _ in range(n):
2369 if 2 in items:
2370 x += 1
2371 return x
2372
2373 res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
2374 self.assertEqual(res, TIER2_THRESHOLD)
2375 self.assertIsNotNone(ex)
2376 uops = get_opnames(ex)
2377 self.assertIn("_CONTAINS_OP", uops)
2378 self.assertIn("_POP_TOP_NOP", uops)
2379 self.assertLessEqual(count_ops(ex, "_POP_TOP"), 2)
2380
2381 def test_contains_op_set(self):
2382 def testfunc(n):

Callers

nothing calls this directly

Calls 7

_run_with_optimizerMethod · 0.95
get_opnamesFunction · 0.85
count_opsFunction · 0.85
assertIsNotNoneMethod · 0.80
assertInMethod · 0.80
assertLessEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected