[Python-checkins] python/dist/src/Lib/test test_codecs.py, 1.15.2.5, 1.15.2.6
doerwalter@users.sourceforge.net
doerwalter at users.sourceforge.net
Thu Jul 21 00:52:11 CEST 2005
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6952/Lib/test
Modified Files:
Tag: release24-maint
test_codecs.py
Log Message:
Backport checkin:
Make attributes and local variables in the StreamReader str objects instead
of unicode objects, so that codecs that do a str->str decoding won't promote
the result to unicode. This fixes SF bug #1241507.
Index: test_codecs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v
retrieving revision 1.15.2.5
retrieving revision 1.15.2.6
diff -u -d -r1.15.2.5 -r1.15.2.6
--- test_codecs.py 21 Apr 2005 21:53:43 -0000 1.15.2.5
+++ test_codecs.py 20 Jul 2005 22:52:09 -0000 1.15.2.6
@@ -665,6 +665,22 @@
f = self.reader(self.stream)
self.assertEquals(f.readlines(), [u'\ud55c\n', u'\uae00'])
+class Str2StrTest(unittest.TestCase):
+
+ def test_read(self):
+ sin = "\x80".encode("base64_codec")
+ reader = codecs.getreader("base64_codec")(StringIO.StringIO(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.StringIO(sin))
+ sout = reader.readline()
+ self.assertEqual(sout, "\x80")
+ self.assert_(isinstance(sout, str))
+
def test_main():
test_support.run_unittest(
UTF16Test,
@@ -677,7 +693,8 @@
NameprepTest,
CodecTest,
CodecsModuleTest,
- StreamReaderTest
+ StreamReaderTest,
+ Str2StrTest
)
More information about the Python-checkins
mailing list