Author: Julian Berman <julian...@grayvines.com> Branch: zlib-copying-redux Changeset: r95856:bf5838a3edac Date: 2019-02-06 11:00 +0100 http://bitbucket.org/pypy/pypy/changeset/bf5838a3edac/
Log: Add a test for copying flushed zlib compressobjs. diff --git a/pypy/module/zlib/test/test_zlib.py b/pypy/module/zlib/test/test_zlib.py --- a/pypy/module/zlib/test/test_zlib.py +++ b/pypy/module/zlib/test/test_zlib.py @@ -307,7 +307,7 @@ assert (d1 + from_copy) == (d1 + from_decompressor) - def test_unsuccessful_decompress_copy(self): + def test_cannot_copy_decompressor_with_stream_in_inconsistent_state(self): decompressor = self.zlib.decompressobj() self.intentionally_break_a_z_stream(zobj=decompressor) raises(self.zlib.error, decompressor.copy) @@ -341,7 +341,12 @@ assert (d1 + from_copy) == (d1 + from_compressor) - def test_unsuccessful_compress_copy(self): + def test_cannot_copy_compressor_with_stream_in_inconsistent_state(self): compressor = self.zlib.compressobj() self.intentionally_break_a_z_stream(zobj=compressor) raises(self.zlib.error, compressor.copy) + + def test_cannot_copy_compressor_with_flushed_stream(self): + compressor = self.zlib.compressobj() + compressor.flush() + raises(ValueError, compressor.copy) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit