-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved some code out of dataset class
- Loading branch information
1 parent
7fffed2
commit f7c3e77
Showing
3 changed files
with
51 additions
and
28 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
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,16 @@ | ||
import pytest | ||
from hub.api.dataset_utils import _get_compressor | ||
import numcodecs | ||
import numcodecs.lz4 | ||
import numcodecs.zstd | ||
from hub.numcodecs import PngCodec | ||
|
||
|
||
def test_get_compression(): | ||
assert _get_compressor("lz4") == numcodecs.LZ4(numcodecs.lz4.DEFAULT_ACCELERATION) | ||
assert _get_compressor(None) is None | ||
assert _get_compressor("default") == "default" | ||
assert _get_compressor("zstd") == numcodecs.Zstd(numcodecs.zstd.DEFAULT_CLEVEL) | ||
assert _get_compressor("png") == PngCodec(solo_channel=True) | ||
with pytest.raises(ValueError): | ||
_get_compressor("abcd") |