[Python-checkins]
python/dist/src/Lib/test test_codecs.py, 1.15.2.2, 1.15.2.3
doerwalter at users.sourceforge.net
doerwalter at users.sourceforge.net
Mon Mar 14 20:20:23 CET 2005
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14630/Lib/test
Modified Files:
Tag: release24-maint
test_codecs.py
Log Message:
Backport checkin:
Reset internal buffers when seek() is called. This fixes SF bug #1156259.
Index: test_codecs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v
retrieving revision 1.15.2.2
retrieving revision 1.15.2.3
diff -u -d -r1.15.2.2 -r1.15.2.3
--- test_codecs.py 10 Jan 2005 12:26:00 -0000 1.15.2.2
+++ test_codecs.py 14 Mar 2005 19:20:19 -0000 1.15.2.3
@@ -24,6 +24,17 @@
return s
class ReadTest(unittest.TestCase):
+ def test_seek(self):
+ # all codecs should be able to encode these
+ s = u"%s\n%s\n" % (100*u"abc123", 100*u"def456")
+ encoding = self.encoding
+ reader = codecs.getreader(encoding)(StringIO.StringIO(s.encode(encoding)))
+ for t in xrange(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)
+
def check_partial(self, input, partialresults):
# get a StreamReader for the encoding and feed the bytestring version
# of input to the reader byte by byte. Read every available from
More information about the Python-checkins
mailing list