Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Oct 18, 2024
1 parent f28775d commit 6a8115c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions numcodecs/_zarr3.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from __future__ import annotations

import asyncio
import math
from dataclasses import dataclass, replace
from functools import cached_property
import math
from typing_extensions import Self
from warnings import warn

import numpy as np
from typing_extensions import Self

import numcodecs

try:
Expand All @@ -18,18 +19,17 @@
except ImportError:
raise ImportError("zarr 3.0.0 or later is required to use the numcodecs zarr integration.")

from zarr.abc.codec import ArrayArrayCodec, BytesBytesCodec, ArrayBytesCodec
from zarr.core.buffer import NDBuffer, Buffer, BufferPrototype
from zarr.core.buffer.cpu import as_numpy_array_wrapper
from zarr.abc.codec import ArrayArrayCodec, ArrayBytesCodec, BytesBytesCodec
from zarr.core.array_spec import ArraySpec
from zarr.core.buffer import Buffer, BufferPrototype, NDBuffer
from zarr.core.buffer.cpu import as_numpy_array_wrapper
from zarr.core.common import (

Check warning on line 26 in numcodecs/_zarr3.py

View check run for this annotation

Codecov / codecov/patch

numcodecs/_zarr3.py#L22-L26

Added lines #L22 - L26 were not covered by tests
JSON,
parse_named_configuration,
product,
)
from zarr.core.metadata import ArrayMetadata

Check warning on line 31 in numcodecs/_zarr3.py

View check run for this annotation

Codecov / codecov/patch

numcodecs/_zarr3.py#L31

Added line #L31 was not covered by tests


CODEC_PREFIX = "numcodecs."

Check warning on line 33 in numcodecs/_zarr3.py

View check run for this annotation

Codecov / codecov/patch

numcodecs/_zarr3.py#L33

Added line #L33 was not covered by tests


Expand Down
12 changes: 8 additions & 4 deletions numcodecs/tests/test_zarr3_import.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from __future__ import annotations

import pytest


def test_zarr3_import():
ERROR_MESSAGE_MATCH = "zarr 3.0.0 or later.*"

try:
import zarr
except ImportError:
pass

if zarr is None or zarr.__version__ < "3.0.0":
with pytest.raises(ImportError):
if zarr.__version__ < "3.0.0":
with pytest.raises(ImportError, match=ERROR_MESSAGE_MATCH):
import numcodecs._zarr3 # noqa: F401

Check warning on line 14 in numcodecs/tests/test_zarr3_import.py

View check run for this annotation

Codecov / codecov/patch

numcodecs/tests/test_zarr3_import.py#L12-L14

Added lines #L12 - L14 were not covered by tests
except ImportError:
with pytest.raises(ImportError, match=ERROR_MESSAGE_MATCH):
import numcodecs._zarr3 # noqa: F401
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ doctest_optionflags = [
"IGNORE_EXCEPTION_DETAIL",
]
testpaths = [
"numcodecs",
"numcodecs/tests",
]
norecursedirs = [
".git",
Expand Down

0 comments on commit 6a8115c

Please sign in to comment.