diff options
author | Georg Brandl <georg@python.org> | 2005-08-21 14:16:04 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-08-21 14:16:04 (GMT) |
commit | 33a5f2af59ddcf3f1b0447a8dbd0576fd78de303 (patch) | |
tree | c3a2210fc27ba900882d74769b56bb4443325753 /Lib | |
parent | f755432f4141fb9f9885435c7ba2d2f6a17d03fe (diff) | |
download | cpython-33a5f2af59ddcf3f1b0447a8dbd0576fd78de303.zip cpython-33a5f2af59ddcf3f1b0447a8dbd0576fd78de303.tar.gz cpython-33a5f2af59ddcf3f1b0447a8dbd0576fd78de303.tar.bz2 |
Fix BZ2File.(x)readlines() for files without a newline.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_bz2.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py index fc8213f..11a5c82 100644 --- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -37,7 +37,7 @@ class BaseTest(unittest.TestCase): return bz2.decompress(data) class BZ2FileTest(BaseTest): - "Test MCRYPT type miscelaneous methods." + "Test BZ2File type miscellaneous methods." def setUp(self): self.filename = TESTFN @@ -245,6 +245,22 @@ class BZ2FileTest(BaseTest): self.assertEqual(f.tell(), len(self.DATA)) f.close() + def testBug1191043(self): + # readlines() for files containing no newline + data = 'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x00!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t' + f = open(self.filename, "wb") + f.write(data) + f.close() + bz2f = BZ2File(self.filename) + lines = bz2f.readlines() + bz2f.close() + self.assertEqual(lines, ['Test']) + bz2f = BZ2File(self.filename) + xlines = bz2f.xreadlines() + bz2f.close() + self.assertEqual(lines, ['Test']) + + class BZ2CompressorTest(BaseTest): def testCompress(self): # "Test BZ2Compressor.compress()/flush()" |