diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-27 09:49:07 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-27 09:50:56 -0400 |
commit | 1329037bfed428e458547824a861ce1aa9df0c78 (patch) | |
tree | c03c62e56d2263c752a257a1f998311e00170982 | |
parent | 19956aa02134dff2bcab2e8818dd600fe2559526 (diff) | |
download | sqlalchemy-1329037bfed428e458547824a861ce1aa9df0c78.tar.gz |
use a lot more random names
very small number of tiny names generated by
random_names() could cause _ordered_name_fixture() to
run out of names.
Fixes: #9706
Change-Id: I3df00c9cf99e76fe82eb535c7fe589b73b10cd67
-rw-r--r-- | test/orm/test_inspect.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/test/orm/test_inspect.py b/test/orm/test_inspect.py index 6ae0d1d3f..ab2e5ae3a 100644 --- a/test/orm/test_inspect.py +++ b/test/orm/test_inspect.py @@ -440,14 +440,16 @@ class TestORMInspection(_fixtures.FixtureTest): import random import keyword - names = { - "".join( - random.choice("abcdegfghijklmnopqrstuvwxyz") - for i in range(random.randint(3, 15)) - ) - for j in range(random.randint(4, 12)) - } - return list(names.difference(keyword.kwlist)) + def _random_name(): + while True: + name = "".join( + random.choice("abcdegfghijklmnopqrstuvwxyz") + for i in range(random.randint(5, 15)) + ) + if name not in keyword.kwlist: + return name + + return [_random_name() for i in range(random.randint(8, 15))] def _ordered_name_fixture(self, glbls, clsname, base, supercls): |