]> granicus.if.org Git - python/commitdiff
Take namedtuple item names only from ascii_letters (this blew up on OSX),
authorGeorg Brandl <georg@python.org>
Sun, 18 May 2008 10:39:26 +0000 (10:39 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 18 May 2008 10:39:26 +0000 (10:39 +0000)
and make sure there are no duplicate names.

Lib/test/test_collections.py

index 15f0bf73ed7a7491f959968ccaec68985b881a44..a770155bdf56554f65fbfc723b5737175c1be6bc 100644 (file)
@@ -110,7 +110,9 @@ class TestNamedTuple(unittest.TestCase):
 
         n = 10000
         import string, random
-        names = [''.join([random.choice(string.letters) for j in range(10)]) for i in range(n)]
+        names = list(set(''.join([random.choice(string.ascii_letters)
+                                  for j in range(10)]) for i in range(n)))
+        n = len(names)
         Big = namedtuple('Big', names)
         b = Big(*range(n))
         self.assertEqual(b, tuple(range(n)))