mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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. :-(
This commit is contained in:
parent
f4cfc8f6bb
commit
024da5c257
10 changed files with 1225 additions and 1227 deletions
|
@ -13,11 +13,11 @@ class Test_CP949(test_multibytecodec_support.TestBase, unittest.TestCase):
|
|||
tstring = test_multibytecodec_support.load_teststring('cp949')
|
||||
codectests = (
|
||||
# invalid bytes
|
||||
("abc\x80\x80\xc1\xc4", "strict", None),
|
||||
("abc\xc8", "strict", None),
|
||||
("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"),
|
||||
("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"),
|
||||
("abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"),
|
||||
(b"abc\x80\x80\xc1\xc4", "strict", None),
|
||||
(b"abc\xc8", "strict", None),
|
||||
(b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"),
|
||||
(b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"),
|
||||
(b"abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"),
|
||||
)
|
||||
|
||||
class Test_EUCKR(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||
|
@ -25,11 +25,11 @@ class Test_EUCKR(test_multibytecodec_support.TestBase, unittest.TestCase):
|
|||
tstring = test_multibytecodec_support.load_teststring('euc_kr')
|
||||
codectests = (
|
||||
# invalid bytes
|
||||
("abc\x80\x80\xc1\xc4", "strict", None),
|
||||
("abc\xc8", "strict", None),
|
||||
("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"),
|
||||
("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"),
|
||||
("abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"),
|
||||
(b"abc\x80\x80\xc1\xc4", "strict", None),
|
||||
(b"abc\xc8", "strict", None),
|
||||
(b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"),
|
||||
(b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"),
|
||||
(b"abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"),
|
||||
)
|
||||
|
||||
class Test_JOHAB(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||
|
@ -37,11 +37,11 @@ class Test_JOHAB(test_multibytecodec_support.TestBase, unittest.TestCase):
|
|||
tstring = test_multibytecodec_support.load_teststring('johab')
|
||||
codectests = (
|
||||
# invalid bytes
|
||||
("abc\x80\x80\xc1\xc4", "strict", None),
|
||||
("abc\xc8", "strict", None),
|
||||
("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ucd27"),
|
||||
("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ucd27\ufffd"),
|
||||
("abc\x80\x80\xc1\xc4", "ignore", "abc\ucd27"),
|
||||
(b"abc\x80\x80\xc1\xc4", "strict", None),
|
||||
(b"abc\xc8", "strict", None),
|
||||
(b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ucd27"),
|
||||
(b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ucd27\ufffd"),
|
||||
(b"abc\x80\x80\xc1\xc4", "ignore", "abc\ucd27"),
|
||||
)
|
||||
|
||||
def test_main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue