-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #349 from berombau/master
Support init of ome_zarr_py.io.ZarrLocation with zarr.storage.FSStore
- Loading branch information
Showing
3 changed files
with
48 additions
and
3 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
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,38 @@ | ||
from pathlib import Path | ||
|
||
import fsspec | ||
import pytest | ||
import zarr | ||
|
||
from ome_zarr.data import create_zarr | ||
from ome_zarr.io import ZarrLocation, parse_url | ||
|
||
|
||
class TestIO: | ||
@pytest.fixture(autouse=True) | ||
def initdir(self, tmpdir): | ||
self.path = tmpdir.mkdir("data") | ||
create_zarr(str(self.path)) | ||
self.store = parse_url(str(self.path), mode="w").store | ||
self.root = zarr.group(store=self.store) | ||
|
||
def test_parse_url(self): | ||
assert parse_url(str(self.path)) | ||
|
||
def test_parse_nonexistent_url(self): | ||
assert parse_url(self.path + "/does-not-exist") is None | ||
|
||
def test_loc_str(self): | ||
assert ZarrLocation(str(self.path)) | ||
|
||
def test_loc_path(self): | ||
assert ZarrLocation(Path(self.path)) | ||
|
||
def test_loc_store(self): | ||
assert ZarrLocation(self.store) | ||
|
||
def test_loc_fs(self): | ||
fs = fsspec.filesystem("memory") | ||
fsstore = zarr.storage.FSStore(url="/", fs=fs) | ||
loc = ZarrLocation(fsstore) | ||
assert loc |