diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/string.py | 9 | ||||
-rw-r--r-- | Lib/test/test_csv.py | 2 | ||||
-rw-r--r-- | Lib/test/test_pkgimport.py | 4 | ||||
-rw-r--r-- | Lib/test/test_string.py | 6 |
4 files changed, 9 insertions, 12 deletions
diff --git a/Lib/string.py b/Lib/string.py index 51b2067..87073aa 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -16,17 +16,14 @@ printable -- a string containing all characters considered printable # Some strings for ctype-style character classification whitespace = ' \t\n\r\v\f' -lowercase = 'abcdefghijklmnopqrstuvwxyz' -uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' -letters = lowercase + uppercase -ascii_lowercase = lowercase -ascii_uppercase = uppercase +ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz' +ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ascii_letters = ascii_lowercase + ascii_uppercase digits = '0123456789' hexdigits = digits + 'abcdef' + 'ABCDEF' octdigits = '01234567' punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" -printable = digits + letters + punctuation + whitespace +printable = digits + ascii_letters + punctuation + whitespace # Case conversion helpers # Use str to convert Unicode literal in case of -U diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 21cc408..7ac52e3 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -645,7 +645,7 @@ class TestArrayWrites(unittest.TestCase): def test_char_write(self): import array, string - a = array.array('u', string.letters) + a = array.array('u', string.ascii_letters) with TemporaryFile("w+b") as fileobj: writer = csv.writer(fileobj, dialect="excel") diff --git a/Lib/test/test_pkgimport.py b/Lib/test/test_pkgimport.py index 8b5e3ad..789f4d3 100644 --- a/Lib/test/test_pkgimport.py +++ b/Lib/test/test_pkgimport.py @@ -7,7 +7,7 @@ class TestImport(unittest.TestCase): def __init__(self, *args, **kw): self.package_name = 'PACKAGE_' while self.package_name in sys.modules: - self.package_name += random.choose(string.letters) + self.package_name += random.choose(string.ascii_letters) self.module_name = self.package_name + '.foo' unittest.TestCase.__init__(self, *args, **kw) @@ -58,7 +58,7 @@ class TestImport(unittest.TestCase): # ...make up a variable name that isn't bound in __builtins__ var = 'a' while var in dir(__builtins__): - var += random.choose(string.letters) + var += random.choose(string.ascii_letters) # ...make a module that just contains that self.rewrite_file(var) diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py index ab75f8c..3b21ebc 100644 --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -6,9 +6,9 @@ class ModuleTest(unittest.TestCase): def test_attrs(self): string.whitespace - string.lowercase - string.uppercase - string.letters + string.ascii_lowercase + string.ascii_uppercase + string.ascii_letters string.digits string.hexdigits string.octdigits |