diff -r 71beb1eb6810 Lib/test/test_codecs.py --- a/Lib/test/test_codecs.py Fri Oct 01 16:49:24 2010 +0200 +++ b/Lib/test/test_codecs.py Fri Oct 01 12:20:30 2010 -0400 @@ -1230,6 +1230,17 @@ f = self.reader(self.stream) self.assertEquals(f.readlines(), ['\ud55c\n', '\uae00']) + def test_readlines_unicode_separators(self): + """Tests that the readlines() method splits on Unicode line separator + (U+2028) and paragraph separator (U+2029) characters in addition to + other line endings (issue 6664). + + """ + teststring = 'line 1\nline 2\u2029line 3'.encode('utf-8') + f = codecs.getreader('utf-8')(io.BytesIO(teststring)) + self.assertEquals(['line 1\n', 'line 2\u2029', 'line 3'], + f.readlines()) + class EncodedFileTest(unittest.TestCase): def test_basic(self): diff -r 71beb1eb6810 Lib/test/test_io.py --- a/Lib/test/test_io.py Fri Oct 01 16:49:24 2010 +0200 +++ b/Lib/test/test_io.py Fri Oct 01 12:20:30 2010 -0400 @@ -2093,6 +2093,17 @@ txt.seek(0) self.assertEqual(txt.readlines(5), ["AA\n", "BB\n"]) + def test_readlines_unicode_separators(self): + """Tests that the readlines() method splits on Unicode line separator + (U+2028) and paragraph separator (U+2029) characters in addition to + other line endings (issue 6664). + + """ + teststring = 'line 1\nline 2\u2029line 3'.encode('utf-8') + txt = self.TextIOWrapper(self.BytesIO(teststring)) + self.assertEquals(['line 1\n', 'line 2\u2029', 'line 3'], + txt.readlines()) + # read in amounts equal to TextIOWrapper._CHUNK_SIZE which is 128. def test_read_by_chunk(self): # make sure "\r\n" straddles 128 char boundary.