Skip to content

Commit

Permalink
Add tests for content_size option when compressing frames
Browse files Browse the repository at this point in the history
  • Loading branch information
dpkp committed Mar 14, 2017
1 parent bc6fb12 commit 0ee6ee8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def test_compress_begin_update_end_not_defaults(self):
block_size=lz4frame.BLOCKSIZE_MAX256KB,
block_mode=lz4frame.BLOCKMODE_LINKED,
compression_level=lz4frame.COMPRESSIONLEVEL_MINHC,
content_size=False,
auto_flush=1
)
chunk_size = 128 * 1024 # 128 kb, half of block size
Expand Down Expand Up @@ -305,6 +306,15 @@ def test_LZ4FrameCompressor_fails(self):
compressed += compressor.flush()
compressed = compressor.compress(input_data)

def test_compress_without_content_size(self):
input_data = b"2099023098234882923049823094823094898239230982349081231290381209380981203981209381238901283098908123109238098123"
compressed = lz4frame.compress(input_data, content_size=False)
frame = lz4frame.get_frame_info(compressed)
self.assertEqual(frame['contentSize'], 0)
decompressed = lz4frame.decompress(compressed)
self.assertEqual(input_data, decompressed)


if sys.version_info < (2, 7):
# Poor-man unittest.TestCase.skip for Python 2.6
del TestLZ4FrameModern
Expand Down

0 comments on commit 0ee6ee8

Please sign in to comment.