def test_lzma_compression(self): from edacc import utils uncompressed_data = "TestData with \x12\x65 weird bytes \n and everything" compressed_data = utils.lzma_compress(uncompressed_data) decompressed_data = utils.lzma_decompress(compressed_data) assert decompressed_data == uncompressed_data assert len(compressed_data) > 13 # there should always be a 13 bytes header len_bytes = struct.unpack('<Q', compressed_data[5:13])[0] assert len_bytes == len(uncompressed_data)
def test_lzma_compression(self): from edacc import utils uncompressed_data = "TestData with \x12\x65 weird bytes \n and everything" compressed_data = utils.lzma_compress(uncompressed_data) decompressed_data = utils.lzma_decompress(compressed_data) assert decompressed_data == uncompressed_data assert len( compressed_data) > 13 # there should always be a 13 bytes header len_bytes = struct.unpack('<Q', compressed_data[5:13])[0] assert len_bytes == len(uncompressed_data)
def set_instance(self, uncompressed_instance): """ Compresses the instance and sets the instance blob attribute """ self.instance = "LZMA" + utils.lzma_compress(uncompressed_instance)