summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bz2.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-08-25 13:10:58 (GMT)
committerGeorg Brandl <georg@python.org>2005-08-25 13:10:58 (GMT)
commit0b5fb781dbc4f312101e8dfed631272416f32e2b (patch)
treed38a9c41677e5ce29e375a9bf88f51d07fb47543 /Lib/test/test_bz2.py
parentdedff272fa40738d282d71a7763ab679fc1f40d3 (diff)
downloadcpython-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.py18
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()"