summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-17 21:52:23 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-17 21:52:23 (GMT)
commitf4cfc8f6bb47e77ca954b58b436f2157b5b6f530 (patch)
tree0b670880c01610c598c477a2022c6dfcc489df5d /Lib/test/test_codecs.py
parentbbbd4fdba2c9589588410a4d1727c031234fc2a6 (diff)
downloadcpython-f4cfc8f6bb47e77ca954b58b436f2157b5b6f530.zip
cpython-f4cfc8f6bb47e77ca954b58b436f2157b5b6f530.tar.gz
cpython-f4cfc8f6bb47e77ca954b58b436f2157b5b6f530.tar.bz2
Make test_codecs work. The CJK codecs now use bytes instead of str8 for
their encoded input/output.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index dba9033..d28b357 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -492,7 +492,7 @@ class EscapeDecodeTest(unittest.TestCase):
class RecodingTest(unittest.TestCase):
def test_recoding(self):
- f = io.StringIO()
+ f = io.BytesIO()
f2 = codecs.EncodedFile(f, "unicode_internal", "utf-8")
f2.write("a")
f2.close()
@@ -1205,7 +1205,7 @@ class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling):
decodedresult = ""
for c in encodedresult:
decodedresult += decoder.decode(bytes([c]))
- decodedresult += decoder.decode("", True)
+ decodedresult += decoder.decode(b"", True)
self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding))
# check C API
@@ -1217,7 +1217,7 @@ class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling):
decodedresult = ""
for c in encodedresult:
decodedresult += cdecoder.decode(bytes([c]))
- decodedresult += cdecoder.decode("", True)
+ decodedresult += cdecoder.decode(b"", True)
self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding))
# check iterencode()/iterdecode()
@@ -1258,8 +1258,8 @@ class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling):
for t in range(5):
# Test that calling seek resets the internal codec state and buffers
reader.seek(0, 0)
- line = reader.readline()
- self.assertEqual(s[:len(line)], line)
+ data = reader.read()
+ self.assertEqual(s, data)
def test_bad_decode_args(self):
for encoding in all_unicode_encodings: