Skip to content

Commit a82b5fb

Browse files
grlee77joshmoore
andauthored
remove option to return None when the input is None from _ensure_store (#1068)
* remove option to return None when the input is None from _ensure_store This capability was contrary to the docstring and does not seem useful * Add None test Co-authored-by: Josh Moore <[email protected]>
1 parent 8f0dedf commit a82b5fb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

zarr/_storage/store.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ def _ensure_store(store: Any):
100100
"""
101101
from zarr.storage import KVStore # avoid circular import
102102

103-
if store is None:
104-
return None
105-
elif isinstance(store, BaseStore):
103+
if isinstance(store, BaseStore):
106104
if not store._store_version == 2:
107105
raise ValueError(
108106
f"cannot initialize a v2 store with a v{store._store_version} store"

zarr/tests/test_storage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class InvalidStore:
7373
with pytest.raises(ValueError):
7474
Store._ensure_store(KVStoreV3(dict()))
7575

76-
assert Store._ensure_store(None) is None
76+
# cannot initialize without a store
77+
with pytest.raises(ValueError):
78+
Store._ensure_store(None)
7779

7880

7981
def test_capabilities():

0 commit comments

Comments
 (0)