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

Method test_contains_op_set

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

Source from the content-addressed store, hash-verified

2379 self.assertLessEqual(count_ops(ex, "_POP_TOP"), 2)
2380
2381 def test_contains_op_set(self):
2382 def testfunc(n):
2383 x = 0
2384 s = {1, 2, 3}
2385 for _ in range(n):
2386 if 2 in s:
2387 x += 1
2388 return x
2389
2390 res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
2391 self.assertEqual(res, TIER2_THRESHOLD)
2392 self.assertIsNotNone(ex)
2393 uops = get_opnames(ex)
2394 self.assertIn("_CONTAINS_OP_SET", uops)
2395 self.assertIn("_POP_TOP_NOP", uops)
2396 self.assertLessEqual(count_ops(ex, "_POP_TOP"), 2)
2397
2398 def test_contains_op_dict(self):
2399 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