summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2005-01-10 12:01:39 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2005-01-10 12:01:39 (GMT)
commit9fa094677186b4bb05e488e5bc9d5dfe7ec32812 (patch)
treed12868a66f07665fa198640df412ccbcef102fb2 /Lib/test/test_codecs.py
parentc0b194a77082f2db4b5689a27e73f07fa046fa79 (diff)
downloadcpython-9fa094677186b4bb05e488e5bc9d5dfe7ec32812.zip
cpython-9fa094677186b4bb05e488e5bc9d5dfe7ec32812.tar.gz
cpython-9fa094677186b4bb05e488e5bc9d5dfe7ec32812.tar.bz2
Fix and test for SF bug #1098990: codec readline() splits lines apart.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 99ed82d..dbe9b88 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -108,6 +108,36 @@ class ReadTest(unittest.TestCase):
writer.write(u"foo\r\n")
self.assertEqual(reader.readline(keepends=True), u"foo\r\n")
+ def test_bug1098990_a(self):
+ s1 = u"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\r\n"
+ s2 = u"offending line: ladfj askldfj klasdj fskla dfzaskdj fasklfj laskd fjasklfzzzzaa%whereisthis!!!\r\n"
+ s3 = u"next line.\r\n"
+
+ s = (s1+s2+s3).encode(self.encoding)
+ stream = StringIO.StringIO(s)
+ reader = codecs.getreader(self.encoding)(stream)
+ self.assertEqual(reader.readline(), s1)
+ self.assertEqual(reader.readline(), s2)
+ self.assertEqual(reader.readline(), s3)
+ self.assertEqual(reader.readline(), u"")
+
+ def test_bug1098990_b(self):
+ s1 = u"aaaaaaaaaaaaaaaaaaaaaaaa\r\n"
+ s2 = u"bbbbbbbbbbbbbbbbbbbbbbbb\r\n"
+ s3 = u"stillokay:bbbbxx\r\n"
+ s4 = u"broken!!!!badbad\r\n"
+ s5 = u"againokay.\r\n"
+
+ s = (s1+s2+s3+s4+s5).encode(self.encoding)
+ stream = StringIO.StringIO(s)
+ reader = codecs.getreader(self.encoding)(stream)
+ self.assertEqual(reader.readline(), s1)
+ self.assertEqual(reader.readline(), s2)
+ self.assertEqual(reader.readline(), s3)
+ self.assertEqual(reader.readline(), s4)
+ self.assertEqual(reader.readline(), s5)
+ self.assertEqual(reader.readline(), u"")
+
class UTF16Test(ReadTest):
encoding = "utf-16"