diff options
author | Andrew M. Kuchling <amk@amk.ca> | 1999-03-22 19:23:17 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 1999-03-22 19:23:17 (GMT) |
commit | dca7e00fd59209bfd823b4111ab73df1ee28aa6d (patch) | |
tree | 5cd99837b0bd50b170167ae77da78019832c43d5 /Lib | |
parent | f247d75507ec767df5ed38e9a2264acb123fe493 (diff) | |
download | cpython-dca7e00fd59209bfd823b4111ab73df1ee28aa6d.zip cpython-dca7e00fd59209bfd823b4111ab73df1ee28aa6d.tar.gz cpython-dca7e00fd59209bfd823b4111ab73df1ee28aa6d.tar.bz2 |
Added simple test for the flush() method of compression objects, trying the
different flush values Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_zlib.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 047e985..719b0e7 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -76,6 +76,19 @@ if decomp2 != buf: else: print "decompressobj with init options succeeded" +# Test flush() with the various options, using all the different levels +# in order to provide more variations. +for sync in [zlib.Z_NO_FLUSH, zlib.Z_SYNC_FLUSH, zlib.Z_FULL_FLUSH]: + for level in range(10): + obj = zlib.compressobj( level ) + d = obj.compress( buf[:3000] ) + d = d + obj.flush( sync ) + d = d + obj.compress( buf[3000:] ) + d = d + obj.flush() + if zlib.decompress(d) != buf: + print "Decompress failed: flush mode=%i, level=%i" % (sync,level) + del obj + def ignore(): """An empty function with a big string. |