-
-
Notifications
You must be signed in to change notification settings - Fork 355
Added ArrayNotFoundError #3367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Added ArrayNotFoundError #3367
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added `~zarr.errors.ArrayNotFoundError`, which is raised when attempting to open a zarr array that does not exist. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,12 @@ | |
save_group, | ||
) | ||
from zarr.core.buffer import NDArrayLike | ||
from zarr.errors import MetadataValidationError, ZarrDeprecationWarning, ZarrUserWarning | ||
from zarr.errors import ( | ||
ArrayNotFoundError, | ||
MetadataValidationError, | ||
ZarrDeprecationWarning, | ||
ZarrUserWarning, | ||
) | ||
from zarr.storage import MemoryStore | ||
from zarr.storage._utils import normalize_path | ||
from zarr.testing.utils import gpu_test | ||
|
@@ -161,7 +166,7 @@ async def test_open_array(memory_store: MemoryStore, zarr_format: ZarrFormat) -> | |
assert z.read_only | ||
|
||
# path not found | ||
with pytest.raises(FileNotFoundError): | ||
with pytest.raises(ArrayNotFoundError): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is currently failing the tests, because it actually raises a |
||
zarr.api.synchronous.open(store="doesnotexist", mode="r", zarr_format=zarr_format) | ||
|
||
|
||
|
@@ -1200,7 +1205,7 @@ async def test_metadata_validation_error() -> None: | |
) | ||
def test_open_array_with_mode_r_plus(store: Store, zarr_format: ZarrFormat) -> None: | ||
# 'r+' means read/write (must exist) | ||
with pytest.raises(FileNotFoundError): | ||
with pytest.raises(ArrayNotFoundError): | ||
zarr.open_array(store=store, mode="r+", zarr_format=zarr_format) | ||
zarr.ones(store=store, shape=(3, 3), zarr_format=zarr_format) | ||
z2 = zarr.open_array(store=store, mode="r+") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also sub-class FileNotFoundError to make sure we retain backwards compatibility.