macresources/test_compress.py
2019-01-11 13:45:06 +08:00

14 lines
560 B
Python

from .macresources.compression import GetEncoding, DecompressResource, CompressResource
def compress_then_extract(dat, encoding):
a = CompressResource(dat, encoding);
if encoding != 'UnknownCompression': assert a.startswith(b'\xA8\x9F\x65\x72')
assert GetEncoding(a) == encoding
b = DecompressResource(a)
assert b == dat
def test_all():
for enc in ['GreggyBits', 'UnknownCompression']:
compress_then_extract(bytes(100), encoding=enc)
compress_then_extract(b'The quick brown fox jumps over the lazy dog', encoding=enc)