Skip to content

Commit a411a58

Browse files
committed
Simplify tests
1 parent bcbf1ff commit a411a58

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,8 +1957,8 @@ def test_call_len_known_length_small_int(self):
19571957
def testfunc(n):
19581958
x = 0
19591959
for _ in range(n):
1960-
a = (1, 2, 3, 4, 5)
1961-
if len(a) == 5:
1960+
t = (1, 2, 3, 4, 5)
1961+
if len(t) == 5:
19621962
x += 1
19631963
return x
19641964

@@ -1975,24 +1975,12 @@ def testfunc(n):
19751975

19761976
def test_call_len_known_length(self):
19771977
def testfunc(n):
1978+
class C:
1979+
t = tuple(range(300))
1980+
19781981
x = 0
19791982
for _ in range(n):
1980-
a = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1981-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1982-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1983-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1984-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1985-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1986-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1987-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1988-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1989-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1990-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1991-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1992-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1993-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1994-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
1995-
if len(a) == 300: # comparison + guard removed
1983+
if len(C.t) == 300: # comparison + guard removed
19961984
x += 1
19971985
return x
19981986

0 commit comments

Comments
 (0)