-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration tests, benchmark updates, subclass Buffer (#83)
Will close #30 Add integration tests with data compressed by third party implementations Update benchmarks for use with igizp Allow subclassing cramjam.Buffer
- Loading branch information
1 parent
fb8d88a
commit 0d40139
Showing
14 changed files
with
130 additions
and
41 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,3 +136,4 @@ dmypy.json | |
#Added by cargo | ||
|
||
/target | ||
.vscode/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ python-snappy==0.5.4 | |
lz4==3.1.0 | ||
brotlipy==0.7.0 | ||
zstd==1.5.0.2 | ||
isal==0.11.1 | ||
numpy | ||
memory-profiler |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
black==21.5b1 | ||
black==22.3.0 | ||
maturin | ||
numpy | ||
pytest>=5.3.0 | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The Zen of Python, by Tim Peters | ||
|
||
Beautiful is better than ugly. | ||
Explicit is better than implicit. | ||
Simple is better than complex. | ||
Complex is better than complicated. | ||
Flat is better than nested. | ||
Sparse is better than dense. | ||
Readability counts. | ||
Special cases aren't special enough to break the rules. | ||
Although practicality beats purity. | ||
Errors should never pass silently. | ||
Unless explicitly silenced. | ||
In the face of ambiguity, refuse the temptation to guess. | ||
There should be one-- and preferably only one --obvious way to do it. | ||
Although that way may not be obvious at first unless you're Dutch. | ||
Now is better than never. | ||
Although never is often better than *right* now. | ||
If the implementation is hard to explain, it's a bad idea. | ||
If the implementation is easy to explain, it may be a good idea. | ||
Namespaces are one honking great idea -- let's do more of those! |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
Test decompressing files which have been compressed from | ||
main stream third party implementations, separate from this project. | ||
""" | ||
import sys | ||
import pathlib | ||
from collections import namedtuple | ||
|
||
import pytest | ||
import cramjam | ||
|
||
|
||
@pytest.fixture | ||
def integration_dir(): | ||
return pathlib.Path(__file__).parent.joinpath("data/integration") | ||
|
||
|
||
@pytest.fixture | ||
def plaintext(integration_dir): | ||
return integration_dir.joinpath("plaintext.txt").read_bytes() | ||
|
||
|
||
Variant = namedtuple("Variant", ("name", "suffix")) | ||
|
||
|
||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Bytes comparison fails on windows") | ||
@pytest.mark.parametrize( | ||
"variant", | ||
( | ||
Variant("gzip", "gz"), | ||
Variant("bzip2", "bz2"), | ||
Variant("zstd", "zst"), | ||
Variant("brotli", "br"), | ||
Variant("lz4", "lz4"), | ||
Variant("snappy", "snappy"), | ||
), | ||
) | ||
def test_variant(variant: Variant, integration_dir: pathlib.Path, plaintext: bytes): | ||
file = integration_dir.joinpath(f"plaintext.txt.{variant.suffix}") | ||
decompress = getattr(cramjam, variant.name).decompress | ||
assert bytes(decompress(file.read_bytes())) == plaintext |