Beispiel #1
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)
Beispiel #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)
Beispiel #3
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)
Beispiel #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)
Beispiel #5
0
 def test_gzip_decompressor_flush(self):
     decompressor = GzipDecompressor()
     data = decompressor.flush()
     self.assertEqual(b'', data)
Beispiel #6
0
 def test_gzip_decompressor_flush(self):
     decompressor = GzipDecompressor()
     data = decompressor.flush()
     self.assertEqual(b'', data)