diff options
author | Dana Powers <dana.powers@gmail.com> | 2016-05-22 13:31:23 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-05-22 15:22:28 -0700 |
commit | 355859ba162666009fb6a06cb7a8805728f0ddff (patch) | |
tree | 0393a7b7768f449174216fb6b0702a87844a5a81 | |
parent | 4cbc1e33747de22ac1e6ea673aea2f2d88b1b632 (diff) | |
download | kafka-python-lz4_0_10.tar.gz |
Update lz4 codec testslz4_0_10
-rw-r--r-- | test/test_codec.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_codec.py b/test/test_codec.py index 07a74cd..906b53c 100644 --- a/test/test_codec.py +++ b/test/test_codec.py @@ -8,6 +8,7 @@ from kafka.codec import ( gzip_encode, gzip_decode, snappy_encode, snappy_decode, lz4_encode, lz4_decode, + lz4_encode_old_kafka, lz4_decode_old_kafka, ) from test.testutil import random_string @@ -84,4 +85,26 @@ def test_lz4(): for i in xrange(1000): b1 = random_string(100).encode('utf-8') b2 = lz4_decode(lz4_encode(b1)) + assert len(b1) == len(b2) + assert b1 == b2 + + +@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available") +def test_lz4_old(): + for i in xrange(1000): + b1 = random_string(100).encode('utf-8') + b2 = lz4_decode_old_kafka(lz4_encode_old_kafka(b1)) + assert len(b1) == len(b2) + assert b1 == b2 + + +@pytest.mark.xfail(reason="lz4tools library doesnt support incremental decompression") +@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available") +def test_lz4_incremental(): + for i in xrange(1000): + # lz4 max single block size is 4MB + # make sure we test with multiple-blocks + b1 = random_string(100).encode('utf-8') * 50000 + b2 = lz4_decode(lz4_encode(b1)) + assert len(b1) == len(b2) assert b1 == b2 |