def test_stream_compress(self): input_data = b"2099023098234882923049823094823094898239230982349081231290381209380981203981209381238901283098908123109238098123" block_size = int((len(input_data) / 2) + 1) stream = lz4.create_stream(block_size) self.assertNotEqual(stream, None) compressed_data1 = lz4.compress_fast_continue(stream, input_data[:block_size]) compressed_data2 = lz4.compress_fast_continue(stream, input_data[block_size:]) lz4.free_stream(stream) stream = lz4.create_decode_stream(block_size) self.assertNotEqual(stream, None) decompressed_data1 = lz4.decompress_safe_continue( stream, compressed_data1) decompressed_data2 = lz4.decompress_safe_continue( stream, compressed_data2) lz4.free_decode_stream(stream) decompressed_data = decompressed_data1 + decompressed_data2 self.assertEqual(decompressed_data, input_data)
def test_stream_compress(self): input_data = b"2099023098234882923049823094823094898239230982349081231290381209380981203981209381238901283098908123109238098123" block_size = int((len(input_data)/2)+1) stream = lz4.create_stream(block_size) self.assertNotEqual(stream, None) compressed_data1 = lz4.compress_fast_continue(stream, input_data[:block_size]) compressed_data2 = lz4.compress_fast_continue(stream, input_data[block_size:]) lz4.free_stream(stream) stream = lz4.create_decode_stream(block_size) self.assertNotEqual(stream, None) decompressed_data1 = lz4.decompress_safe_continue(stream, compressed_data1) decompressed_data2 = lz4.decompress_safe_continue(stream, compressed_data2) lz4.free_decode_stream(stream) decompressed_data = decompressed_data1+decompressed_data2 self.assertEqual(decompressed_data, input_data)
def test_create_and_free_stream(self): stream = lz4.create_stream(4*1024) self.assertNotEqual(stream, None) lz4.free_stream(stream)
def test_create_and_free_stream(self): stream = lz4.create_stream(4 * 1024) self.assertNotEqual(stream, None) lz4.free_stream(stream)