Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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 changes/3483.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that prevented `PCodec` from being properly resolved when loading arrays using that compressor.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ test = [
"pytest-xdist",
"packaging",
"tomlkit",
"uv"
"uv",
"pcodec",
"zfpy",
]
remote_tests = [
'zarr[remote]',
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/codecs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
register_codec(
"numcodecs.jenkins_lookup3", JenkinsLookup3, qualname="zarr.codecs.numcodecs.JenkinsLookup3"
)
register_codec("numcodecs.pcodec", PCodec, qualname="zarr.codecs.numcodecs.pcodec")
register_codec("numcodecs.pcodec", PCodec, qualname="zarr.codecs.numcodecs.PCodec")
register_codec("numcodecs.packbits", PackBits, qualname="zarr.codecs.numcodecs.PackBits")
register_codec("numcodecs.quantize", Quantize, qualname="zarr.codecs.numcodecs.Quantize")
register_codec("numcodecs.shuffle", Shuffle, qualname="zarr.codecs.numcodecs.Shuffle")
Expand Down
11 changes: 8 additions & 3 deletions tests/test_codecs/test_numcodecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from zarr.abc.numcodec import _is_numcodec, _is_numcodec_cls
from zarr.codecs import numcodecs as _numcodecs
from zarr.errors import ZarrUserWarning
from zarr.registry import get_numcodec
from zarr.registry import get_codec_class, get_numcodec

if TYPE_CHECKING:
from collections.abc import Iterator
Expand Down Expand Up @@ -74,18 +74,23 @@ def test_is_numcodec_cls() -> None:

ALL_CODECS = tuple(
filter(
lambda v: isinstance(v, _numcodecs._NumcodecsCodec),
lambda v: issubclass(v, _numcodecs._NumcodecsCodec) and hasattr(v, "codec_name"),
tuple(getattr(_numcodecs, cls_name) for cls_name in _numcodecs.__all__),
)
)


@pytest.mark.parametrize("codec_cls", ALL_CODECS)
def test_get_codec_class(codec_cls: type[_numcodecs._NumcodecsCodec]) -> None:
assert get_codec_class(codec_cls.codec_name) == codec_cls # type: ignore[comparison-overlap]


@pytest.mark.parametrize("codec_class", ALL_CODECS)
def test_docstring(codec_class: type[_numcodecs._NumcodecsCodec]) -> None:
"""
Test that the docstring for the zarr.numcodecs codecs references the wrapped numcodecs class.
"""
assert "See :class:`numcodecs." in codec_class.__doc__ # type: ignore[operator]
assert "See [numcodecs." in codec_class.__doc__ # type: ignore[operator]


@pytest.mark.parametrize(
Expand Down
Loading