|
1 | 1 | from __future__ import annotations |
| 2 | + |
2 | 3 | import array |
3 | 4 | import json as _json |
4 | 5 | import os |
5 | 6 | from glob import glob |
6 | 7 | from typing import TYPE_CHECKING |
| 8 | + |
7 | 9 | if TYPE_CHECKING: |
8 | | - from typing import Sequence |
| 10 | + from collections.abc import Sequence |
9 | 11 |
|
10 | 12 | import numpy as np |
11 | | -from numcodecs.abc import Codec |
12 | 13 | import pytest |
13 | 14 | from numpy.testing import assert_array_almost_equal, assert_array_equal |
14 | 15 |
|
15 | 16 | from numcodecs import * # noqa: F403 # for eval to find names in repr tests |
| 17 | +from numcodecs.abc import Codec |
16 | 18 | from numcodecs.compat import ensure_bytes, ensure_ndarray |
17 | 19 | from numcodecs.registry import get_codec |
18 | 20 |
|
@@ -120,7 +122,9 @@ def check_encode_decode(arr: np.ndarray, codec: Codec, precision: int | None = N |
120 | 122 | compare_arrays(arr, out, precision=precision) |
121 | 123 |
|
122 | 124 |
|
123 | | -def check_encode_decode_partial(arr: np.ndarray, codec: Codec, precision: int | None = None) -> None: |
| 125 | +def check_encode_decode_partial( |
| 126 | + arr: np.ndarray, codec: Codec, precision: int | None = None |
| 127 | +) -> None: |
124 | 128 | # N.B., watch out here with blosc compressor, if the itemsize of |
125 | 129 | # the source buffer is different then the results of encoding |
126 | 130 | # (i.e., compression) may be different. Hence we *do not* require that |
@@ -247,7 +251,13 @@ def check_repr(stmt: str) -> None: |
247 | 251 | assert stmt == actual |
248 | 252 |
|
249 | 253 |
|
250 | | -def check_backwards_compatibility(codec_id: str, arrays: Sequence[np.ndarray], codecs: Sequence[Codec], precision: Sequence[int | None] | None = None, prefix: str | None = None) -> None: |
| 254 | +def check_backwards_compatibility( |
| 255 | + codec_id: str, |
| 256 | + arrays: Sequence[np.ndarray], |
| 257 | + codecs: Sequence[Codec], |
| 258 | + precision: Sequence[int | None] | None = None, |
| 259 | + prefix: str | None = None, |
| 260 | +) -> None: |
251 | 261 | # setup directory to hold data fixture |
252 | 262 | if prefix: |
253 | 263 | fixture_dir = os.path.join('fixture', codec_id, prefix) |
|
0 commit comments