diff options
Diffstat (limited to 'Lib/test/test_normalization.py')
-rw-r--r-- | Lib/test/test_normalization.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py index 3040a086187..e3e25603564 100644 --- a/Lib/test/test_normalization.py +++ b/Lib/test/test_normalization.py @@ -1,7 +1,7 @@ -from test.test_support import run_unittest, open_urlresource +from test.support import run_unittest, open_urlresource import unittest -from httplib import HTTPException +from http.client import HTTPException import sys import os from unicodedata import normalize, unidata_version @@ -33,7 +33,7 @@ def unistr(data): for x in data: if x > sys.maxunicode: raise RangeError - return u"".join([unichr(x) for x in data]) + return "".join([chr(x) for x in data]) class NormalizationTest(unittest.TestCase): def test_main(self): @@ -41,9 +41,11 @@ class NormalizationTest(unittest.TestCase): part1_data = {} # Hit the exception early try: - testdata = open_urlresource(TESTDATAURL, check_version) + testdata = open_urlresource(TESTDATAURL, encoding="utf-8", + check=check_version) except (IOError, HTTPException): self.skipTest("Could not retrieve " + TESTDATAURL) + self.addCleanup(testdata.close) for line in testdata: if '#' in line: line = line.split('#')[0] @@ -85,14 +87,14 @@ class NormalizationTest(unittest.TestCase): # Perform tests for all other data for c in range(sys.maxunicode+1): - X = unichr(c) + X = chr(c) if X in part1_data: continue self.assertTrue(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c) def test_bug_834676(self): # Check for bug 834676 - normalize('NFC', u'\ud55c\uae00') + normalize('NFC', '\ud55c\uae00') def test_main(): |