summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-16 12:47:53 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-16 12:47:53 (GMT)
commit9d2ac227210fa8c7ba14a581747d1a1836e7274c (patch)
tree59c65cffa19f4429d84b2a2f929447e1a1086c68 /Lib/test/test_codecs.py
parentc9e363c2eb3eed920bcd0d08a2eabdfa939b1270 (diff)
downloadcpython-9d2ac227210fa8c7ba14a581747d1a1836e7274c.zip
cpython-9d2ac227210fa8c7ba14a581747d1a1836e7274c.tar.gz
cpython-9d2ac227210fa8c7ba14a581747d1a1836e7274c.tar.bz2
Fix io.StringIO: String are stored encoded (using "unicode-internal" as the
encoding) which makes the buffer mutable. Strings are encoded on the way in and decoded on the way out. Use io.StringIO in test_codecs.py. Fix the base64_codec test in test_codecs.py.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index f61cc33..03be34c 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -2,7 +2,6 @@ from test import test_support
import unittest
import codecs
import sys, _testcapi, io
-from StringIO import StringIO
class Queue(object):
"""
@@ -493,7 +492,7 @@ class EscapeDecodeTest(unittest.TestCase):
class RecodingTest(unittest.TestCase):
def test_recoding(self):
- f = StringIO()
+ f = io.StringIO()
f2 = codecs.EncodedFile(f, "unicode_internal", "utf-8")
f2.write("a")
f2.close()
@@ -991,14 +990,14 @@ class Str2StrTest(unittest.TestCase):
def test_read(self):
sin = "\x80".encode("base64_codec")
- reader = codecs.getreader("base64_codec")(StringIO(sin))
+ reader = codecs.getreader("base64_codec")(io.BytesIO(sin))
sout = reader.read()
self.assertEqual(sout, "\x80")
self.assert_(isinstance(sout, str))
def test_readline(self):
sin = "\x80".encode("base64_codec")
- reader = codecs.getreader("base64_codec")(StringIO(sin))
+ reader = codecs.getreader("base64_codec")(io.BytesIO(sin))
sout = reader.readline()
self.assertEqual(sout, "\x80")
self.assert_(isinstance(sout, str))