diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2005-12-17 04:38:31 (GMT) |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2005-12-17 04:38:31 (GMT) |
commit | cb92b45e4112cd871bc2dfc30e3bd879afa9ee60 (patch) | |
tree | dade85682cd312fb90aa865de9197666938fa0c8 /Lib/test | |
parent | a35865fada8bb234e2b7ab61e45a4c62a7d8b054 (diff) | |
download | cpython-cb92b45e4112cd871bc2dfc30e3bd879afa9ee60.zip cpython-cb92b45e4112cd871bc2dfc30e3bd879afa9ee60.tar.gz cpython-cb92b45e4112cd871bc2dfc30e3bd879afa9ee60.tar.bz2 |
Bug #1379994: Fix *unicode_escape codecs to encode r'\' as r'\\'
just like string codecs.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_unicode.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 69244f0..16356b0 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -611,20 +611,24 @@ class UnicodeTest( self.assertEqual(u'hello'.encode('latin-1'), 'hello') # Roundtrip safety for BMP (just the first 1024 chars) - u = u''.join(map(unichr, xrange(1024))) - for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', - 'raw_unicode_escape', 'unicode_escape', 'unicode_internal'): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + for c in xrange(1024): + u = unichr(c) + for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', + 'utf-16-be', 'raw_unicode_escape', + 'unicode_escape', 'unicode_internal'): + self.assertEqual(unicode(u.encode(encoding),encoding), u) # Roundtrip safety for BMP (just the first 256 chars) - u = u''.join(map(unichr, xrange(256))) - for encoding in ('latin-1',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + for c in xrange(256): + u = unichr(c) + for encoding in ('latin-1',): + self.assertEqual(unicode(u.encode(encoding),encoding), u) # Roundtrip safety for BMP (just the first 128 chars) - u = u''.join(map(unichr, xrange(128))) - for encoding in ('ascii',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + for c in xrange(128): + u = unichr(c) + for encoding in ('ascii',): + self.assertEqual(unicode(u.encode(encoding),encoding), u) # Roundtrip safety for non-BMP (just a few chars) u = u'\U00010001\U00020002\U00030003\U00040004\U00050005' |