Skip to content

Commit

Permalink
make specialization warmup more explicit in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Jul 24, 2023
1 parent 9a6bdfa commit 7003e96
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Lib/test/test_super.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from test import shadowed_super


ADAPTIVE_WARMUP_DELAY = 2


class A:
def f(self):
return 'A'
Expand Down Expand Up @@ -419,8 +422,8 @@ def test(name):
super(MyType, type(mytype)).__setattr__(mytype, "bar", 1)
self.assertEqual(mytype.bar, 1)

test("foo1")
test("foo2")
for _ in range(ADAPTIVE_WARMUP_DELAY):
test("foo1")

def test_reassigned_new(self):
class A:
Expand All @@ -438,8 +441,8 @@ class C(B):
def __new__(cls):
return super().__new__(cls)

C()
C()
for _ in range(ADAPTIVE_WARMUP_DELAY):
C()

def test_mixed_staticmethod_hierarchy(self):
# This test is just a desugared version of `test_reassigned_new`
Expand All @@ -458,8 +461,8 @@ class C(B):
def some(cls):
return super().some(cls)

C.some(C)
C.some(C)
for _ in range(ADAPTIVE_WARMUP_DELAY):
C.some(C)


if __name__ == "__main__":
Expand Down

0 comments on commit 7003e96

Please sign in to comment.