]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
block python keywords from random list of names
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 14 Oct 2020 17:50:44 +0000 (13:50 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 14 Oct 2020 17:51:04 +0000 (13:51 -0400)
Change-Id: I0259bed2ee06e741889e8b9bed6bf6ad106fa425
(cherry picked from commit b03d5358ec83ad7484ccd452e63ab34e874b53b3)

test/orm/test_inspect.py

index 3130269b153912fd5ccce41c4a2ae48ebb671e0b..7e7f8d867e92b736d6cf7dea8c3040832ea98c24 100644 (file)
@@ -434,14 +434,16 @@ class TestORMInspection(_fixtures.FixtureTest):
 
     def _random_names(self):
         import random
+        import keyword
 
-        return [
+        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 _ordered_name_fixture(self, glbls, clsname, base, supercls):
         import random