def test_gzip_decompressor_not_gzip(self): decompressor = GzipDecompressor() data = decompressor.decompress(b'LAMMA ') data += decompressor.decompress(b'JUMP') data += decompressor.flush() self.assertEqual(b'LAMMA JUMP', data)
def test_gzip_decompressor(self): file_buffer = io.BytesIO() gzip_file = gzip.GzipFile(mode='wb', fileobj=file_buffer) gzip_file.write(b'HELLO KITTEN') gzip_file.close() decompressor = GzipDecompressor() data = decompressor.decompress(file_buffer.getvalue()[:5]) data += decompressor.decompress(file_buffer.getvalue()[5:]) data += decompressor.flush() self.assertEqual(b'HELLO KITTEN', data)