Skip to content

Commit 157202e

Browse files
committed
count_ops
1 parent ba0ebf8 commit 157202e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4646,7 +4646,7 @@ def testfunc(n):
46464646
self.assertEqual(res, TIER2_THRESHOLD)
46474647
self.assertIsNotNone(ex)
46484648
uops = get_opnames(ex)
4649-
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
4649+
self.assertGreaterEqual(count_ops(ex, "_LOAD_CONST_INLINE_BORROW"), 2)
46504650
self.assertNotIn("_BINARY_OP_SUBSCR_DICT", uops)
46514651

46524652
def test_binary_subscr_frozendict_const_fold(self):
@@ -4661,8 +4661,8 @@ def testfunc(n):
46614661
self.assertEqual(res, TIER2_THRESHOLD)
46624662
self.assertIsNotNone(ex)
46634663
uops = get_opnames(ex)
4664+
self.assertGreaterEqual(count_ops(ex, "_LOAD_CONST_INLINE_BORROW"), 3)
46644665
# lookup result is folded to constant 1, so comparison is optimized away
4665-
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
46664666
self.assertNotIn("_COMPARE_OP_INT", uops)
46674667

46684668
def test_contains_op_frozenset_const_fold(self):
@@ -4677,7 +4677,7 @@ def testfunc(n):
46774677
self.assertEqual(res, TIER2_THRESHOLD)
46784678
self.assertIsNotNone(ex)
46794679
uops = get_opnames(ex)
4680-
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
4680+
self.assertGreaterEqual(count_ops(ex, "_LOAD_CONST_INLINE_BORROW"), 3)
46814681
self.assertNotIn("_CONTAINS_OP_SET", uops)
46824682

46834683
def test_contains_op_frozendict_const_fold(self):
@@ -4692,7 +4692,7 @@ def testfunc(n):
46924692
self.assertEqual(res, TIER2_THRESHOLD)
46934693
self.assertIsNotNone(ex)
46944694
uops = get_opnames(ex)
4695-
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
4695+
self.assertGreaterEqual(count_ops(ex, "_LOAD_CONST_INLINE_BORROW"), 3)
46964696
self.assertNotIn("_CONTAINS_OP_DICT", uops)
46974697

46984698
def test_not_contains_op_frozendict_const_fold(self):
@@ -4707,7 +4707,7 @@ def testfunc(n):
47074707
self.assertEqual(res, TIER2_THRESHOLD)
47084708
self.assertIsNotNone(ex)
47094709
uops = get_opnames(ex)
4710-
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
4710+
self.assertGreaterEqual(count_ops(ex, "_LOAD_CONST_INLINE_BORROW"), 3)
47114711
self.assertNotIn("_CONTAINS_OP_DICT", uops)
47124712

47134713
def test_binary_subscr_list_slice(self):

0 commit comments

Comments
 (0)