Created
May 5, 2020 09:20
-
-
Save aadps/69fc585b452ac70699af7eca0287250d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import lilcom | |
import numpy as np | |
a = np.empty((0)) | |
b = lilcom.compress(a) | |
assert b[0] == 76 | |
assert b[1] == 0 | |
print("Header begins with \"L0\"") | |
try: | |
lilcom.decompress(bytes()) | |
except ValueError as e: | |
print(e.args[0]) | |
assert e.args[0] == "lilcom: Length of string was too short" | |
pass | |
try: | |
lilcom.decompress(bytes("X00", "utf-8")) | |
except ValueError as e: | |
print(e.args[0]) | |
assert e.args[0] == "lilcom: Lilcom-compressed data must begin with L" | |
pass | |
try: | |
lilcom.decompress(bytes("L10", "utf-8")) | |
except ValueError as e: | |
print(e.args[0]) | |
assert e.args[0] == "lilcom: Trying to decompress data from a future "\ | |
"format version (use newer code)" | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fantastic! You can make a PR including my changes plus your change, to master.