Skip to content

Commit 11a468d

Browse files
committed
Measure the complexity directly using the big-O library. Fixes python/cpython#102209.
1 parent bf85e75 commit 11a468d

4 files changed

Lines changed: 11 additions & 43 deletions

File tree

‎setup.cfg‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ testing =
4646

4747
# local
4848
jaraco.itertools
49-
func-timeout
5049
jaraco.functools
5150
more_itertools
51+
big-O
5252

5353
docs =
5454
# upstream

‎tests/_context.py‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎tests/_func_timeout_compat.py‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎tests/test_zipp.py‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
import unittest
1111
import zipfile
1212

13+
import big_o
1314
import jaraco.itertools
1415
from jaraco.functools import compose
1516

1617
import zipp
1718

1819
from ._test_params import parameterize, Invoked
19-
from ._func_timeout_compat import set_timeout
2020

2121

2222
consume = tuple
@@ -336,10 +336,16 @@ def test_joinpath_constant_time(self):
336336
# Check the file iterated all items
337337
assert entries.count == self.HUGE_ZIPFILE_NUM_ENTRIES
338338

339-
@set_timeout(3)
340339
def test_implied_dirs_performance(self):
341-
data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)]
342-
consume(zipp.CompleteDirs._implied_dirs(data))
340+
best, others = big_o.big_o(
341+
compose(consume, zipp.CompleteDirs._implied_dirs),
342+
lambda size: [
343+
'/'.join(string.ascii_lowercase + str(n)) for n in range(size)
344+
],
345+
max_n=1000,
346+
min_n=1,
347+
)
348+
assert best.__class__ is big_o.complexities.Linear
343349

344350
@pass_alpharep
345351
def test_read_does_not_close(self, alpharep):

0 commit comments

Comments
 (0)