diff --git a/zarr/_storage/store.py b/zarr/_storage/store.py index 36a5c0bff5..6faf4a1250 100644 --- a/zarr/_storage/store.py +++ b/zarr/_storage/store.py @@ -100,9 +100,7 @@ def _ensure_store(store: Any): """ from zarr.storage import KVStore # avoid circular import - if store is None: - return None - elif isinstance(store, BaseStore): + if isinstance(store, BaseStore): if not store._store_version == 2: raise ValueError( f"cannot initialize a v2 store with a v{store._store_version} store" diff --git a/zarr/tests/test_storage.py b/zarr/tests/test_storage.py index abddb6965c..a3e227ec86 100644 --- a/zarr/tests/test_storage.py +++ b/zarr/tests/test_storage.py @@ -73,7 +73,9 @@ class InvalidStore: with pytest.raises(ValueError): Store._ensure_store(KVStoreV3(dict())) - assert Store._ensure_store(None) is None + # cannot initialize without a store + with pytest.raises(ValueError): + Store._ensure_store(None) def test_capabilities():