summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-10-01 03:21:22 +0000
committerMartin Panter <vadmium+py@gmail.com>2016-10-01 03:21:22 +0000
commitefd1bf443431529d1d2f21fc8f77ed78557e8245 (patch)
treec4c8dee175873d5ab5f376c33238802f26b09b2f /Lib
parentc4bd96cce2023e21feb615e703968b25b2ae6aac (diff)
parent55c9239af613682ec141bf6b2c4eb77497943088 (diff)
downloadcpython-git-efd1bf443431529d1d2f21fc8f77ed78557e8245.tar.gz
Issue #28275: Merge bz2 fix from 3.6
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_bz2.py6
-rw-r--r--Lib/test/test_lzma.py8
2 files changed, 9 insertions, 5 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 450ab2e23a..46ad2c44d8 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -821,6 +821,12 @@ class BZ2DecompressorTest(BaseTest):
out.append(bzd.decompress(self.DATA[300:]))
self.assertEqual(b''.join(out), self.TEXT)
+ def test_failure(self):
+ bzd = BZ2Decompressor()
+ self.assertRaises(Exception, bzd.decompress, self.BAD_DATA * 30)
+ # Previously, a second call could crash due to internal inconsistency
+ self.assertRaises(Exception, bzd.decompress, self.BAD_DATA * 30)
+
class CompressDecompressTest(BaseTest):
def testCompress(self):
data = bz2.compress(self.TEXT)
diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py
index 77ca022f45..228db66c43 100644
--- a/Lib/test/test_lzma.py
+++ b/Lib/test/test_lzma.py
@@ -249,11 +249,9 @@ class CompressorDecompressorTestCase(unittest.TestCase):
def test_decompressor_bug_28275(self):
# Test coverage for Issue 28275
lzd = LZMADecompressor()
- for i in range(2):
- try:
- lzd.decompress(COMPRESSED_RAW_1)
- except LZMAError:
- pass
+ self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_RAW_1)
+ # Previously, a second call could crash due to internal inconsistency
+ self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_RAW_1)
# Test that LZMACompressor->LZMADecompressor preserves the input data.