summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_codecs.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index da6891f..c8d99fe 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -24,6 +24,17 @@ class Queue(object):
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