Skip to content

Commit 6a8115c

Browse files
committed
tests
1 parent f28775d commit 6a8115c

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

numcodecs/_zarr3.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from __future__ import annotations
22

33
import asyncio
4+
import math
45
from dataclasses import dataclass, replace
56
from functools import cached_property
6-
import math
7-
from typing_extensions import Self
87
from warnings import warn
98

109
import numpy as np
10+
from typing_extensions import Self
11+
1112
import numcodecs
1213

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

21-
from zarr.abc.codec import ArrayArrayCodec, BytesBytesCodec, ArrayBytesCodec
22-
from zarr.core.buffer import NDBuffer, Buffer, BufferPrototype
23-
from zarr.core.buffer.cpu import as_numpy_array_wrapper
22+
from zarr.abc.codec import ArrayArrayCodec, ArrayBytesCodec, BytesBytesCodec
2423
from zarr.core.array_spec import ArraySpec
24+
from zarr.core.buffer import Buffer, BufferPrototype, NDBuffer
25+
from zarr.core.buffer.cpu import as_numpy_array_wrapper
2526
from zarr.core.common import (
2627
JSON,
2728
parse_named_configuration,
2829
product,
2930
)
3031
from zarr.core.metadata import ArrayMetadata
3132

32-
3333
CODEC_PREFIX = "numcodecs."
3434

3535

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
from __future__ import annotations
2+
23
import pytest
34

45

56
def test_zarr3_import():
7+
ERROR_MESSAGE_MATCH = "zarr 3.0.0 or later.*"
8+
69
try:
710
import zarr
8-
except ImportError:
9-
pass
1011

11-
if zarr is None or zarr.__version__ < "3.0.0":
12-
with pytest.raises(ImportError):
12+
if zarr.__version__ < "3.0.0":
13+
with pytest.raises(ImportError, match=ERROR_MESSAGE_MATCH):
14+
import numcodecs._zarr3 # noqa: F401
15+
except ImportError:
16+
with pytest.raises(ImportError, match=ERROR_MESSAGE_MATCH):
1317
import numcodecs._zarr3 # noqa: F401

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ doctest_optionflags = [
132132
"IGNORE_EXCEPTION_DETAIL",
133133
]
134134
testpaths = [
135-
"numcodecs",
135+
"numcodecs/tests",
136136
]
137137
norecursedirs = [
138138
".git",

0 commit comments

Comments
 (0)