diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-06-07 11:26:16 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-06-07 11:26:16 (GMT) |
commit | 092a225a4de9b168e541e3c57b1bee075f6382a8 (patch) | |
tree | bd63d1d84752480893dd2dc99d83b8f413059b24 /Lib/test/test_codecs.py | |
parent | 9cbfffd1a63ee944dedda758ac1d1963d4cbf3b1 (diff) | |
download | cpython-092a225a4de9b168e541e3c57b1bee075f6382a8.zip cpython-092a225a4de9b168e541e3c57b1bee075f6382a8.tar.gz cpython-092a225a4de9b168e541e3c57b1bee075f6382a8.tar.bz2 |
Fix tests for unicode-internal codec.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r-- | Lib/test/test_codecs.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index d28b357..0081e23 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -631,34 +631,34 @@ class UnicodeInternalTest(unittest.TestCase): # points" above 0x10ffff on UCS-4 builds. if sys.maxunicode > 0xffff: ok = [ - ("\x00\x10\xff\xff", "\U0010ffff"), - ("\x00\x00\x01\x01", "\U00000101"), - ("", ""), + (b"\x00\x10\xff\xff", "\U0010ffff"), + (b"\x00\x00\x01\x01", "\U00000101"), + (b"", ""), ] not_ok = [ - "\x7f\xff\xff\xff", - "\x80\x00\x00\x00", - "\x81\x00\x00\x00", - "\x00", - "\x00\x00\x00\x00\x00", + b"\x7f\xff\xff\xff", + b"\x80\x00\x00\x00", + b"\x81\x00\x00\x00", + b"\x00", + b"\x00\x00\x00\x00\x00", ] for internal, uni in ok: if sys.byteorder == "little": - internal = "".join(reversed(internal)) + internal = bytes(reversed(internal)) self.assertEquals(uni, internal.decode("unicode_internal")) for internal in not_ok: if sys.byteorder == "little": - internal = "".join(reversed(internal)) + internal = bytes(reversed(internal)) self.assertRaises(UnicodeDecodeError, internal.decode, "unicode_internal") def test_decode_error_attributes(self): if sys.maxunicode > 0xffff: try: - "\x00\x00\x00\x00\x00\x11\x11\x00".decode("unicode_internal") + b"\x00\x00\x00\x00\x00\x11\x11\x00".decode("unicode_internal") except UnicodeDecodeError as ex: self.assertEquals("unicode_internal", ex.encoding) - self.assertEquals("\x00\x00\x00\x00\x00\x11\x11\x00", ex.object) + self.assertEquals(b"\x00\x00\x00\x00\x00\x11\x11\x00", ex.object) self.assertEquals(4, ex.start) self.assertEquals(8, ex.end) else: @@ -669,7 +669,7 @@ class UnicodeInternalTest(unittest.TestCase): codecs.register_error("UnicodeInternalTest", codecs.ignore_errors) decoder = codecs.getdecoder("unicode_internal") ab = "ab".encode("unicode_internal") - ignored = decoder("%s\x22\x22\x22\x22%s" % (ab[:4], ab[4:]), + ignored = decoder(bytes("%s\x22\x22\x22\x22%s" % (ab[:4], ab[4:])), "UnicodeInternalTest") self.assertEquals(("ab", 12), ignored) |