forked from zarr-developers/zarr-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pytest | ||
|
||
from zarr.array import Array | ||
from zarr.common import ZarrFormat | ||
from zarr.group import Group | ||
from zarr.store import LocalStore, MemoryStore | ||
|
||
|
||
@pytest.mark.parametrize("store", ("local", "memory"), indirect=["store"]) | ||
@pytest.mark.parametrize("zarr_format", (2, 3)) | ||
def test_array_name_properties_no_group( | ||
store: LocalStore | MemoryStore, zarr_format: ZarrFormat | ||
) -> None: | ||
arr = Array.create(store=store, shape=(100,), chunks=(10,), zarr_format=zarr_format, dtype="i4") | ||
assert arr.path == "" | ||
assert arr.name is None | ||
assert arr.basename is None | ||
|
||
|
||
@pytest.mark.parametrize("store", ("local", "memory"), indirect=["store"]) | ||
@pytest.mark.parametrize("zarr_format", (2, 3)) | ||
def test_array_name_properties_with_group( | ||
store: LocalStore | MemoryStore, zarr_format: ZarrFormat | ||
) -> None: | ||
root = Group.create(store=store, zarr_format=zarr_format) | ||
foo = root.create_array("foo", shape=(100,), chunks=(10,), dtype="i4") | ||
assert foo.path == "foo" | ||
assert foo.name == "/foo" | ||
assert foo.basename == "foo" | ||
|
||
bar = root.create_group("bar") | ||
spam = bar.create_array("spam", shape=(100,), chunks=(10,), dtype="i4") | ||
|
||
assert spam.path == "bar/spam" | ||
assert spam.name == "/bar/spam" | ||
assert spam.basename == "spam" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters