| 1 |
import pyppmd |
| 2 |
|
| 3 |
source = "This file is located in a folder.This file is located in the root.\n" |
| 4 |
encoded = ( |
| 5 |
b"\x54\x16\x43\x6d\x5c\xd8\xd7\x3a\xb3\x58\x31\xac\x1d\x09\x23\xfd\x11\xd5\x72\x62\x73" |
| 6 |
b"\x13\xb6\xce\xb2\xe7\x6a\xb9\xf6\xe8\x66\xf5\x08\xc3\x0a\x09\x36\x12\xeb\xda\xda\xba" |
| 7 |
) |
| 8 |
READ_BLOCKSIZE = 16384 |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
def test_compress_str(): |
| 13 |
assert pyppmd.compress(source, max_order=6, mem_size=8 << 20) == encoded |
| 14 |
|
| 15 |
|
| 16 |
def test_compress(): |
| 17 |
assert pyppmd.compress(source.encode("UTF-8"), max_order=6, mem_size=8 << 20) == encoded |
| 18 |
|
| 19 |
|
| 20 |
def test_decompress_str(): |
| 21 |
assert pyppmd.decompress_str(encoded, max_order=6, mem_size=8 << 20, encoding="UTF-8") == source |
| 22 |
|
| 23 |
|
| 24 |
def test_decompress(): |
| 25 |
assert pyppmd.decompress(encoded, max_order=6, mem_size=8 << 20) == source.encode("UTF-8") |