diff options
author | Guido van Rossum <guido@python.org> | 2007-05-17 23:59:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-17 23:59:11 (GMT) |
commit | 024da5c2576f196dede4bfa0fc5808019bd54fd8 (patch) | |
tree | 5ddf497e06e42dac48d3d17ee288332b0a956296 /Lib/test/test_codecencodings_jp.py | |
parent | f4cfc8f6bb47e77ca954b58b436f2157b5b6f530 (diff) | |
download | cpython-024da5c2576f196dede4bfa0fc5808019bd54fd8.zip cpython-024da5c2576f196dede4bfa0fc5808019bd54fd8.tar.gz cpython-024da5c2576f196dede4bfa0fc5808019bd54fd8.tar.bz2 |
Make all the multibyte codec tests pass.
Changes to io.py, necessary to make this work:
- Redid io.StringIO as a TextIOWrapper on top of a BytesIO instance.
- Got rid of _MemoryIOMixin, folding it into BytesIO instead.
- The read() functions that take -1 to mean "eveything" now also take None.
- Added readline() support to BufferedIOBase. :-(
Diffstat (limited to 'Lib/test/test_codecencodings_jp.py')
-rw-r--r-- | Lib/test/test_codecencodings_jp.py | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/Lib/test/test_codecencodings_jp.py b/Lib/test/test_codecencodings_jp.py index 3da093a..5d939a6 100644 --- a/Lib/test/test_codecencodings_jp.py +++ b/Lib/test/test_codecencodings_jp.py @@ -13,14 +13,14 @@ class Test_CP932(test_multibytecodec_support.TestBase, unittest.TestCase): tstring = test_multibytecodec_support.load_teststring('shift_jis') codectests = ( # invalid bytes - ("abc\x81\x00\x81\x00\x82\x84", "strict", None), - ("abc\xf8", "strict", None), - ("abc\x81\x00\x82\x84", "replace", "abc\ufffd\uff44"), - ("abc\x81\x00\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), - ("abc\x81\x00\x82\x84", "ignore", "abc\uff44"), + (b"abc\x81\x00\x81\x00\x82\x84", "strict", None), + (b"abc\xf8", "strict", None), + (b"abc\x81\x00\x82\x84", "replace", "abc\ufffd\uff44"), + (b"abc\x81\x00\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), + (b"abc\x81\x00\x82\x84", "ignore", "abc\uff44"), # sjis vs cp932 - ("\\\x7e", "replace", "\\\x7e"), - ("\x81\x5f\x81\x61\x81\x7c", "replace", "\uff3c\u2225\uff0d"), + (b"\\\x7e", "replace", "\\\x7e"), + (b"\x81\x5f\x81\x61\x81\x7c", "replace", "\uff3c\u2225\uff0d"), ) class Test_EUC_JISX0213(test_multibytecodec_support.TestBase, @@ -29,28 +29,28 @@ class Test_EUC_JISX0213(test_multibytecodec_support.TestBase, tstring = test_multibytecodec_support.load_teststring('euc_jisx0213') codectests = ( # invalid bytes - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), - ("abc\x8f\x83\x83", "replace", "abc\ufffd"), - ("\xc1\x64", "strict", None), - ("\xa1\xc0", "strict", "\uff3c"), + (b"abc\x80\x80\xc1\xc4", "strict", None), + (b"abc\xc8", "strict", None), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), + (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), + (b"abc\x8f\x83\x83", "replace", "abc\ufffd"), + (b"\xc1\x64", "strict", None), + (b"\xa1\xc0", "strict", "\uff3c"), ) xmlcharnametest = ( "\xab\u211c\xbb = \u2329\u1234\u232a", - "\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" + b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" ) eucjp_commontests = ( - ("abc\x80\x80\xc1\xc4", "strict", None), - ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), - ("abc\x8f\x83\x83", "replace", "abc\ufffd"), - ("\xc1\x64", "strict", None), + (b"abc\x80\x80\xc1\xc4", "strict", None), + (b"abc\xc8", "strict", None), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), + (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), + (b"abc\x8f\x83\x83", "replace", "abc\ufffd"), + (b"\xc1\x64", "strict", None), ) class Test_EUC_JP_COMPAT(test_multibytecodec_support.TestBase, @@ -58,25 +58,25 @@ class Test_EUC_JP_COMPAT(test_multibytecodec_support.TestBase, encoding = 'euc_jp' tstring = test_multibytecodec_support.load_teststring('euc_jp') codectests = eucjp_commontests + ( - ("\xa1\xc0\\", "strict", "\uff3c\\"), - ("\xa5", "strict", "\x5c"), - ("\u203e", "strict", "\x7e"), + (b"\xa1\xc0\\", "strict", "\uff3c\\"), + ("\xa5", "strict", b"\x5c"), + ("\u203e", "strict", b"\x7e"), ) shiftjis_commonenctests = ( - ("abc\x80\x80\x82\x84", "strict", None), - ("abc\xf8", "strict", None), - ("abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), - ("abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), - ("abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), + (b"abc\x80\x80\x82\x84", "strict", None), + (b"abc\xf8", "strict", None), + (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), + (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), + (b"abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), ) class Test_SJIS_COMPAT(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'shift_jis' tstring = test_multibytecodec_support.load_teststring('shift_jis') codectests = shiftjis_commonenctests + ( - ("\\\x7e", "strict", "\\\x7e"), - ("\x81\x5f\x81\x61\x81\x7c", "strict", "\uff3c\u2016\u2212"), + (b"\\\x7e", "strict", "\\\x7e"), + (b"\x81\x5f\x81\x61\x81\x7c", "strict", "\uff3c\u2016\u2212"), ) class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): @@ -84,18 +84,18 @@ class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): tstring = test_multibytecodec_support.load_teststring('shift_jisx0213') codectests = ( # invalid bytes - ("abc\x80\x80\x82\x84", "strict", None), - ("abc\xf8", "strict", None), - ("abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), - ("abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), - ("abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), + (b"abc\x80\x80\x82\x84", "strict", None), + (b"abc\xf8", "strict", None), + (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), + (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), + (b"abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), # sjis vs cp932 - ("\\\x7e", "replace", "\xa5\u203e"), - ("\x81\x5f\x81\x61\x81\x7c", "replace", "\x5c\u2016\u2212"), + (b"\\\x7e", "replace", "\xa5\u203e"), + (b"\x81\x5f\x81\x61\x81\x7c", "replace", "\x5c\u2016\u2212"), ) xmlcharnametest = ( "\xab\u211c\xbb = \u2329\u1234\u232a", - "\x85Gℜ\x85Q = ⟨ሴ⟩" + b"\x85Gℜ\x85Q = ⟨ሴ⟩" ) def test_main(): |