-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move complexity tests to their own module.
- Loading branch information
Showing
3 changed files
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import importlib | ||
import unittest | ||
|
||
|
||
def import_or_skip(name): | ||
try: | ||
return importlib.import_module(name) | ||
except ImportError: # pragma: no cover | ||
raise unittest.SkipTest(f'Unable to import {name}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
import string | ||
|
||
import zipp | ||
from jaraco.functools import compose | ||
from more_itertools import consume | ||
|
||
from ._support import import_or_skip | ||
|
||
|
||
big_o = import_or_skip('big_o') | ||
|
||
|
||
class TestComplexity(unittest.TestCase): | ||
def test_implied_dirs_performance(self): | ||
best, others = big_o.big_o( | ||
compose(consume, zipp.CompleteDirs._implied_dirs), | ||
lambda size: [ | ||
'/'.join(string.ascii_lowercase + str(n)) for n in range(size) | ||
], | ||
max_n=1000, | ||
min_n=1, | ||
) | ||
assert best <= big_o.complexities.Linear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters