From d2f04070740e956e99d7e40bd6d5ce5ba5b3bfee Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Mon, 21 Oct 2024 06:01:26 -0700 Subject: [PATCH] update zarr pin to v3.0.0b1 (#302) * update zarr pin * Sync normalize path test from zarr 3 test suite --------- Co-authored-by: Matthew Iannucci --- icechunk-python/pyproject.toml | 2 +- icechunk-python/tests/test_zarr/test_api.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/icechunk-python/pyproject.toml b/icechunk-python/pyproject.toml index 1ca5fd6f..9434c4ca 100644 --- a/icechunk-python/pyproject.toml +++ b/icechunk-python/pyproject.toml @@ -16,7 +16,7 @@ classifiers = [ license = { text = "Apache-2.0" } dynamic = ["version"] -dependencies = ["zarr==3.0.0b0"] +dependencies = ["zarr==3.0.0b1"] [tool.poetry] name = "icechunk" diff --git a/icechunk-python/tests/test_zarr/test_api.py b/icechunk-python/tests/test_zarr/test_api.py index baa88ffa..5baf8fd7 100644 --- a/icechunk-python/tests/test_zarr/test_api.py +++ b/icechunk-python/tests/test_zarr/test_api.py @@ -1,11 +1,12 @@ import pathlib +from typing import Literal import numpy as np import pytest import zarr from icechunk import IcechunkStore from numpy.testing import assert_array_equal -from zarr import Array, Group +from zarr import Array, Group, group from zarr.abc.store import Store from zarr.api.synchronous import ( create, @@ -16,6 +17,7 @@ save_array, save_group, ) +from zarr.storage._utils import normalize_path from ..conftest import parse_store @@ -46,6 +48,21 @@ def test_create_array(memory_store: Store) -> None: assert z.chunks == (40,) +@pytest.mark.parametrize("path", ["foo", "/", "/foo", "///foo/bar"]) +@pytest.mark.parametrize("node_type", ["array", "group"]) +def test_open_normalized_path( + memory_store: IcechunkStore, path: str, node_type: Literal["array", "group"] +) -> None: + node: Group | Array + if node_type == "group": + node = group(store=memory_store, path=path) + elif node_type == "array": + node = create(store=memory_store, path=path, shape=(2,)) + + assert node.path == normalize_path(path) + + + async def test_open_array(memory_store: IcechunkStore) -> None: store = memory_store