def test_reset_decompression_context_1(): if lz4.library_version_number() >= 10800: context = lz4frame.create_decompression_context() r = lz4frame.reset_decompression_context(context) assert r is None else: pass
def test_reset_decompression_context_2(): if lz4.library_version_number() >= 10800: c = lz4frame.compress(b'1234', return_bytearray=False) context = lz4frame.create_decompression_context() try: # Simulate an error by passing junk to decompress d = lz4frame.decompress_chunk(context, c[4:]) except RuntimeError: pass r = lz4frame.reset_decompression_context(context) assert r is None # And confirm we can use the context after reset d, bytes_read, eof = lz4frame.decompress_chunk(context, c) assert d == b'1234' assert bytes_read == len(c) assert eof is True else: pass
def test_reset_decompression_context_2(): if lz4.library_version_number() >= 10800: c = lz4frame.compress(b'1234', return_bytearray=False) context = lz4frame.create_decompression_context() try: # Simulate an error by passing junk to decompress d = lz4frame.decompress_chunk(context, c[1:3]) except: pass r = lz4frame.reset_decompression_context(context) assert r is None # And confirm we can use the context after reset d, bytes_read, eof = lz4frame.decompress_chunk(context, c) assert d == b'1234' assert bytes_read == len(c) assert eof == True else: pass
def __init__(self, block_size=BLOCKSIZE_DEFAULT, block_linked=True, compression_level=COMPRESSIONLEVEL_MIN, content_checksum=False, block_checksum=False, auto_flush=False, return_bytearray=False): self.block_size = block_size self.block_linked = block_linked self.compression_level = compression_level self.content_checksum = content_checksum if block_checksum and lz4.library_version_number() < 10800: raise RuntimeError( 'Attempt to set block_checksum to True with LZ4 library' 'version < 10800') self.block_checksum = block_checksum self.auto_flush = auto_flush self.return_bytearray = return_bytearray self._context = None self._started = False
def __init__(self, block_size=BLOCKSIZE_DEFAULT, block_linked=True, compression_level=COMPRESSIONLEVEL_MIN, content_checksum=False, block_checksum=False, auto_flush=False, return_bytearray=False): self.block_size = block_size self.block_linked = block_linked self.compression_level = compression_level self.content_checksum = content_checksum if block_checksum and lz4.library_version_number() < 10800: raise RuntimeError( 'Attempt to set block_checksum to True with LZ4 library' 'version < 10800' ) self.block_checksum = block_checksum self.auto_flush = auto_flush self.return_bytearray = return_bytearray self._context = None self._started = False
) def block_linked(request): return request.param @pytest.fixture( params=[ (True), (False), ] ) def content_checksum(request): return request.param if lz4.library_version_number() >= 10800: p = [True, False] else: p = [False, ] @pytest.fixture( params=[ (pp) for pp in p ] ) def block_checksum(request): return request.param compression_levels = [
def test_library_version_number(): v = lz4.library_version_number() assert isinstance(v, int) assert v > 10000
(True), (False), ]) def block_linked(request): return request.param @pytest.fixture(params=[ (True), (False), ]) def content_checksum(request): return request.param if lz4.library_version_number() >= 10800: p = [True, False] else: p = [ False, ] @pytest.fixture(params=[(pp) for pp in p]) def block_checksum(request): return request.param compression_levels = [ (lz4frame.COMPRESSIONLEVEL_MIN), (lz4frame.COMPRESSIONLEVEL_MINHC),