Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get codec #79

Merged
merged 2 commits into from
May 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions numcodecs/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def get_codec(config):
Zlib(level=1)

"""
config = dict(config)
codec_id = config.pop('id', None)
cls = codec_registry.get(codec_id, None)
if cls is None:
Expand Down
1 change: 0 additions & 1 deletion numcodecs/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ def check_err_decode_object_buffer(compressor):
out = np.empty(10, dtype=object)
with pytest.raises(ValueError):
compressor.decode(enc, out=out)
print(out[:])


def check_err_encode_object_buffer(compressor):
Expand Down
8 changes: 8 additions & 0 deletions numcodecs/tests/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@
def test_registry_errors():
with pytest.raises(ValueError):
get_codec({'id': 'foo'})


def test_get_codec_argument():
# Check that get_codec doesn't modify its argument.
arg = {"id": "json"}
before = dict(arg)
get_codec(arg)
assert before == arg