From d9bf5aab8b39c6a124d9499ae0315d3bf2ac2f46 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 12 Mar 2024 21:27:29 -0400 Subject: [PATCH] Fix name generator for width=1 --- tests/test_complexity.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_complexity.py b/tests/test_complexity.py index 67e9c17..ce20fd3 100644 --- a/tests/test_complexity.py +++ b/tests/test_complexity.py @@ -44,13 +44,15 @@ def make_zip_path(self, depth=1, width=1) -> zipp.Path: @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'] """ # 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)