diff options
author | Georg Brandl <georg@python.org> | 2005-08-25 13:10:58 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-08-25 13:10:58 (GMT) |
commit | 0b5fb781dbc4f312101e8dfed631272416f32e2b (patch) | |
tree | d38a9c41677e5ce29e375a9bf88f51d07fb47543 /Lib/test/test_bz2.py | |
parent | dedff272fa40738d282d71a7763ab679fc1f40d3 (diff) | |
download | cpython-0b5fb781dbc4f312101e8dfed631272416f32e2b.zip cpython-0b5fb781dbc4f312101e8dfed631272416f32e2b.tar.gz cpython-0b5fb781dbc4f312101e8dfed631272416f32e2b.tar.bz2 |
Backport fixes for bugs #1191043 and #1215928.
Diffstat (limited to 'Lib/test/test_bz2.py')
-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()" |