Exemplo n.º 1
0
    def testDecompress(self):
        """Tests the Decompress method."""
        decompressor = zlib_decompressor.DeflateDecompressor()

        compressed_data = (
            b'\x0b\xc9\xc8,V\x00\xa2D\x85\x92\xd4\xe2\x12=\x00)\x97\x05$')

        uncompressed_data, _ = decompressor.Decompress(compressed_data)
        expected_uncompressed_data = b'This is a test.'
        self.assertEqual(uncompressed_data, expected_uncompressed_data)

        decompressor = zlib_decompressor.DeflateDecompressor()

        with self.assertRaises(errors.BackEndError):
            decompressor.Decompress(b'This is a test.')
Exemplo n.º 2
0
    def __init__(self, stream_start):
        """Initializes a gzip member decompressor wrapper.

    Args:
      stream_start (int): offset to the compressed stream within the containing
          file object.
    """
        self._decompressor = zlib_decompressor.DeflateDecompressor()
        self.last_read = stream_start
        self.uncompressed_offset = 0
        self._compressed_data = b''