Skip to content

Commit e8e6107

Browse files
committed
use Posixpath instead of Path in tests; avoid redundant cast
1 parent 181d3d0 commit e8e6107

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
import pathlib
44
from dataclasses import dataclass, field
5-
from typing import TYPE_CHECKING, cast
5+
from typing import TYPE_CHECKING
66

77
import numpy as np
88
import numpy.typing as npt
99
import pytest
1010
from hypothesis import HealthCheck, Verbosity, settings
1111

1212
from zarr import AsyncGroup, config
13-
from zarr.abc.codec import Codec
1413
from zarr.abc.store import Store
1514
from zarr.codecs.sharding import ShardingCodec, ShardingCodecIndexLocation
1615
from zarr.core.array import (
@@ -32,6 +31,7 @@
3231

3332
from _pytest.compat import LEGACY_PATH
3433

34+
from zarr.abc.codec import Codec
3535
from zarr.core.array import CompressorsLike, FiltersLike, SerializerLike, ShardsLike
3636
from zarr.core.chunk_key_encodings import ChunkKeyEncoding, ChunkKeyEncodingLike
3737
from zarr.core.common import ChunkCoords, MemoryOrder, ShapeLike, ZarrFormat
@@ -273,7 +273,7 @@ def create_array_metadata(
273273
dtype=dtype_parsed,
274274
)
275275

276-
sub_codecs = cast(tuple[Codec, ...], (*array_array, array_bytes, *bytes_bytes))
276+
sub_codecs = (*array_array, array_bytes, *bytes_bytes)
277277
codecs_out: tuple[Codec, ...]
278278
if shard_shape_parsed is not None:
279279
index_location = None

tests/test_group.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import operator
55
import pickle
66
import warnings
7-
from pathlib import Path
7+
from pathlib import PosixPath
88
from typing import TYPE_CHECKING, Any, Literal
99

1010
import numpy as np
@@ -1457,7 +1457,7 @@ async def test_create_nodes(store: Store, zarr_format: ZarrFormat) -> None:
14571457
}
14581458
spath = await make_store_path(store, path="foo")
14591459
observed_nodes = {
1460-
str(Path(a.name).relative_to("/" + path)): a
1460+
str(PosixPath(a.name).relative_to("/" + path)): a
14611461
async for a in create_nodes(store_path=spath, nodes=expected_meta)
14621462
}
14631463
assert expected_meta == {k: v.metadata for k, v in observed_nodes.items()}
@@ -1480,7 +1480,7 @@ async def test_create_hierarchy(store: Store, zarr_format: ZarrFormat) -> None:
14801480
expected_meta = hierarchy_spec | {"group/subgroup": GroupMetadata(zarr_format=zarr_format)}
14811481
spath = await make_store_path(store, path="foo")
14821482
observed_nodes = {
1483-
str(Path(a.name).relative_to("/" + path)): a
1483+
str(PosixPath(a.name).relative_to("/" + path)): a
14841484
async for a in create_hierarchy(store_path=spath, nodes=expected_meta)
14851485
}
14861486
assert expected_meta == {k: v.metadata for k, v in observed_nodes.items()}

0 commit comments

Comments
 (0)