コード例 #1
0
ファイル: decompression_test.py プロジェクト: Super-Rad/wpull
    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)
コード例 #2
0
    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)
コード例 #3
0
ファイル: decompression_test.py プロジェクト: Super-Rad/wpull
    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)
コード例 #4
0
    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)