diff options
| author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-05-14 12:29:07 (GMT) | 
|---|---|---|
| committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-05-14 12:29:07 (GMT) | 
| commit | 0cc4fd9df7e2a6d6a47c20e66c5b22d590c6be51 (patch) | |
| tree | 1f9553a5b486926d712b24f909bd55222d094724 /Lib/test | |
| parent | 9b323a521c8612093ff1d23b25c4d9809601e1d6 (diff) | |
| download | cpython-0cc4fd9df7e2a6d6a47c20e66c5b22d590c6be51.zip cpython-0cc4fd9df7e2a6d6a47c20e66c5b22d590c6be51.tar.gz cpython-0cc4fd9df7e2a6d6a47c20e66c5b22d590c6be51.tar.bz2 | |
Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail
attribute when called without a max_length argument.
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_zlib.py | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index a003611..7f63143 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -310,6 +310,15 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):          self.assertRaises(ValueError, dco.decompress, "", -1)          self.assertEqual('', dco.unconsumed_tail) +    def test_clear_unconsumed_tail(self): +        # Issue #12050: calling decompress() without providing max_length +        # should clear the unconsumed_tail attribute. +        cdata = "x\x9cKLJ\x06\x00\x02M\x01"     # "abc" +        dco = zlib.decompressobj() +        ddata = dco.decompress(cdata, 1) +        ddata += dco.decompress(dco.unconsumed_tail) +        self.assertEqual(dco.unconsumed_tail, "") +      def test_flushes(self):          # Test flush() with the various options, using all the          # different levels in order to provide more variations. | 
