mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-106531: Refresh zipfile._path with zipp 3.18. (#116835)
* gh-106531: Refresh zipfile._path with zipp 3.18. * Add blurb
This commit is contained in:
parent
ab9e322ae1
commit
be59aaf3ab
5 changed files with 159 additions and 54 deletions
|
@ -43,13 +43,17 @@ class TestComplexity(unittest.TestCase):
|
|||
@classmethod
|
||||
def make_names(cls, width, letters=string.ascii_lowercase):
|
||||
"""
|
||||
>>> list(TestComplexity.make_names(1))
|
||||
['a']
|
||||
>>> list(TestComplexity.make_names(2))
|
||||
['a', 'b']
|
||||
>>> list(TestComplexity.make_names(30))
|
||||
['aa', 'ab', ..., 'bd']
|
||||
>>> list(TestComplexity.make_names(17124))
|
||||
['aaa', 'aab', ..., 'zip']
|
||||
"""
|
||||
# determine how many products are needed to produce width
|
||||
n_products = math.ceil(math.log(width, len(letters)))
|
||||
n_products = max(1, math.ceil(math.log(width, len(letters))))
|
||||
inputs = (letters,) * n_products
|
||||
combinations = itertools.product(*inputs)
|
||||
names = map(''.join, combinations)
|
||||
|
@ -80,7 +84,7 @@ class TestComplexity(unittest.TestCase):
|
|||
max_n=100,
|
||||
min_n=1,
|
||||
)
|
||||
assert best <= big_o.complexities.Quadratic
|
||||
assert best <= big_o.complexities.Linear
|
||||
|
||||
@pytest.mark.flaky
|
||||
def test_glob_width(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue