diff options
Diffstat (limited to 'Lib/test/test_ucn.py')
-rw-r--r-- | Lib/test/test_ucn.py | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py index 775044b..4472e90 100644 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -17,7 +17,7 @@ class UnicodeNamesTest(unittest.TestCase): # Helper that put all \N escapes inside eval'd raw strings, # to make sure this script runs even if the compiler # chokes on \N escapes - res = eval(ur'u"\N{%s}"' % name) + res = eval(r'u"\N{%s}"' % name) self.assertEqual(res, code) return res @@ -51,10 +51,10 @@ class UnicodeNamesTest(unittest.TestCase): "LATIN SMALL LETTER P", "FULL STOP" ] - string = u"The rEd fOx ate the sheep." + string = "The rEd fOx ate the sheep." self.assertEqual( - u"".join([self.checkletter(*args) for args in zip(chars, string)]), + "".join([self.checkletter(*args) for args in zip(chars, string)]), string ) @@ -67,30 +67,30 @@ class UnicodeNamesTest(unittest.TestCase): self.assertEqual(unicodedata.name(code), name) def test_hangul_syllables(self): - self.checkletter("HANGUL SYLLABLE GA", u"\uac00") - self.checkletter("HANGUL SYLLABLE GGWEOSS", u"\uafe8") - self.checkletter("HANGUL SYLLABLE DOLS", u"\ub3d0") - self.checkletter("HANGUL SYLLABLE RYAN", u"\ub7b8") - self.checkletter("HANGUL SYLLABLE MWIK", u"\ubba0") - self.checkletter("HANGUL SYLLABLE BBWAEM", u"\ubf88") - self.checkletter("HANGUL SYLLABLE SSEOL", u"\uc370") - self.checkletter("HANGUL SYLLABLE YI", u"\uc758") - self.checkletter("HANGUL SYLLABLE JJYOSS", u"\ucb40") - self.checkletter("HANGUL SYLLABLE KYEOLS", u"\ucf28") - self.checkletter("HANGUL SYLLABLE PAN", u"\ud310") - self.checkletter("HANGUL SYLLABLE HWEOK", u"\ud6f8") - self.checkletter("HANGUL SYLLABLE HIH", u"\ud7a3") + self.checkletter("HANGUL SYLLABLE GA", "\uac00") + self.checkletter("HANGUL SYLLABLE GGWEOSS", "\uafe8") + self.checkletter("HANGUL SYLLABLE DOLS", "\ub3d0") + self.checkletter("HANGUL SYLLABLE RYAN", "\ub7b8") + self.checkletter("HANGUL SYLLABLE MWIK", "\ubba0") + self.checkletter("HANGUL SYLLABLE BBWAEM", "\ubf88") + self.checkletter("HANGUL SYLLABLE SSEOL", "\uc370") + self.checkletter("HANGUL SYLLABLE YI", "\uc758") + self.checkletter("HANGUL SYLLABLE JJYOSS", "\ucb40") + self.checkletter("HANGUL SYLLABLE KYEOLS", "\ucf28") + self.checkletter("HANGUL SYLLABLE PAN", "\ud310") + self.checkletter("HANGUL SYLLABLE HWEOK", "\ud6f8") + self.checkletter("HANGUL SYLLABLE HIH", "\ud7a3") import unicodedata - self.assertRaises(ValueError, unicodedata.name, u"\ud7a4") + self.assertRaises(ValueError, unicodedata.name, "\ud7a4") def test_cjk_unified_ideographs(self): - self.checkletter("CJK UNIFIED IDEOGRAPH-3400", u"\u3400") - self.checkletter("CJK UNIFIED IDEOGRAPH-4DB5", u"\u4db5") - self.checkletter("CJK UNIFIED IDEOGRAPH-4E00", u"\u4e00") - self.checkletter("CJK UNIFIED IDEOGRAPH-9FA5", u"\u9fa5") - self.checkletter("CJK UNIFIED IDEOGRAPH-20000", u"\U00020000") - self.checkletter("CJK UNIFIED IDEOGRAPH-2A6D6", u"\U0002a6d6") + self.checkletter("CJK UNIFIED IDEOGRAPH-3400", "\u3400") + self.checkletter("CJK UNIFIED IDEOGRAPH-4DB5", "\u4db5") + self.checkletter("CJK UNIFIED IDEOGRAPH-4E00", "\u4e00") + self.checkletter("CJK UNIFIED IDEOGRAPH-9FA5", "\u9fa5") + self.checkletter("CJK UNIFIED IDEOGRAPH-20000", "\U00020000") + self.checkletter("CJK UNIFIED IDEOGRAPH-2A6D6", "\U0002a6d6") def test_bmp_characters(self): import unicodedata @@ -103,38 +103,38 @@ class UnicodeNamesTest(unittest.TestCase): count += 1 def test_misc_symbols(self): - self.checkletter("PILCROW SIGN", u"\u00b6") - self.checkletter("REPLACEMENT CHARACTER", u"\uFFFD") - self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", u"\uFF9F") - self.checkletter("FULLWIDTH LATIN SMALL LETTER A", u"\uFF41") + self.checkletter("PILCROW SIGN", "\u00b6") + self.checkletter("REPLACEMENT CHARACTER", "\uFFFD") + self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", "\uFF9F") + self.checkletter("FULLWIDTH LATIN SMALL LETTER A", "\uFF41") def test_errors(self): import unicodedata self.assertRaises(TypeError, unicodedata.name) - self.assertRaises(TypeError, unicodedata.name, u'xx') + self.assertRaises(TypeError, unicodedata.name, 'xx') self.assertRaises(TypeError, unicodedata.lookup) - self.assertRaises(KeyError, unicodedata.lookup, u'unknown') + self.assertRaises(KeyError, unicodedata.lookup, 'unknown') def test_strict_eror_handling(self): # bogus character name self.assertRaises( UnicodeError, - unicode, "\\N{blah}", 'unicode-escape', 'strict' + str, "\\N{blah}", 'unicode-escape', 'strict' ) # long bogus character name self.assertRaises( UnicodeError, - unicode, "\\N{%s}" % ("x" * 100000), 'unicode-escape', 'strict' + str, "\\N{%s}" % ("x" * 100000), 'unicode-escape', 'strict' ) # missing closing brace self.assertRaises( UnicodeError, - unicode, "\\N{SPACE", 'unicode-escape', 'strict' + str, "\\N{SPACE", 'unicode-escape', 'strict' ) # missing opening brace self.assertRaises( UnicodeError, - unicode, "\\NSPACE", 'unicode-escape', 'strict' + str, "\\NSPACE", 'unicode-escape', 'strict' ) def test_main(): |