diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unicode.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index bdc7192..24e8e77 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -736,12 +736,25 @@ class UnicodeTest( print >>out, u'def\n' def test_ucs4(self): - if sys.maxunicode == 0xFFFF: - return x = u'\U00100000' y = x.encode("raw-unicode-escape").decode("raw-unicode-escape") self.assertEqual(x, y) + y = r'\U00100000' + x = y.decode("raw-unicode-escape").encode("raw-unicode-escape") + self.assertEqual(x, y) + y = r'\U00010000' + x = y.decode("raw-unicode-escape").encode("raw-unicode-escape") + self.assertEqual(x, y) + + try: + '\U11111111'.decode("raw-unicode-escape") + except UnicodeDecodeError as e: + self.assertEqual(e.start, 0) + self.assertEqual(e.end, 10) + else: + self.fail("Should have raised UnicodeDecodeError") + def test_conversion(self): # Make sure __unicode__() works properly class Foo0: |