summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-10-06 05:08:26 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-10-06 05:08:26 (GMT)
commit504de6bd2c3a0b717e1192eac2435808ab971c5a (patch)
tree31e03bdb5772e80173d4398058ad970b4f792664 /Lib/test/test_unicode.py
parentdbe3d280e70c8a2a5542839a118333d645192b79 (diff)
downloadcpython-504de6bd2c3a0b717e1192eac2435808ab971c5a.zip
cpython-504de6bd2c3a0b717e1192eac2435808ab971c5a.tar.gz
cpython-504de6bd2c3a0b717e1192eac2435808ab971c5a.tar.bz2
Fix for SF bug [ 817156 ] invalid \U escape gives 0=length unistr.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 6e40b9f..18a2d46 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -33,6 +33,13 @@ class UnicodeTest(
self.assertEqual(realresult, result)
self.assert_(object is not realresult)
+ def test_literals(self):
+ self.assertEqual(u'\xff', u'\u00ff')
+ self.assertEqual(u'\uffff', u'\U0000ffff')
+ self.assertRaises(UnicodeError, eval, 'u\'\\Ufffffffe\'')
+ self.assertRaises(UnicodeError, eval, 'u\'\\Uffffffff\'')
+ self.assertRaises(UnicodeError, eval, 'u\'\\U%08x\'' % 0x110000)
+
def test_repr(self):
if not sys.platform.startswith('java'):
# Test basic sanity of repr()