Skip to content

Commit

Permalink
Improve readaility of initdir
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed May 19, 2024
1 parent df42754 commit ec33420
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions napari_ome_zarr/_tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@
class TestNapari:
@pytest.fixture(autouse=True)
def initdir(self, tmp_path: Path):
"""
Write some temporary test data.
create_zarr() creates an image pyramid and labels zarr directories.
"""
self.path_3d = tmp_path / "data_3d"
self.path_3d.mkdir()
create_zarr(self.path_3d, astronaut, "astronaut")
create_zarr(self.path_3d, method=astronaut, label_name="astronaut")

self.path_2d = tmp_path / "data_2d"
self.path_2d.mkdir()
create_zarr(self.path_2d)

self.n_layers = 2

def test_get_reader_hit(self):
reader = napari_get_reader(self.path_3d)
assert reader is not None
Expand All @@ -29,7 +36,7 @@ def test_reader(self, path):
path_str = str(getattr(self, path))
reader = napari_get_reader(path_str)
results = reader(path_str)
assert len(results) == 2
assert len(results) == self.n_layers
image, label = results
assert isinstance(image[0], list)
assert isinstance(image[1], dict)
Expand All @@ -54,7 +61,7 @@ def test_get_reader_pass(self):
def assert_layers(self, layers, visible_1, visible_2, path="path_3d"):
# TODO: check name

assert len(layers) == 2
assert len(layers) == self.n_datasets
image, label = layers

data, metadata, layer_type = self.assert_layer(image)
Expand Down

0 comments on commit ec33420

Please sign in to comment.