Skip to content

Commit

Permalink
Add test for single channel name
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Jul 16, 2024
1 parent 5f9e201 commit 983edb9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions napari_ome_zarr/_tests/test_reader.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import sys
from pathlib import Path

import numpy as np
import pytest
import zarr
from ome_zarr.data import astronaut, create_zarr
from ome_zarr.io import parse_url
from ome_zarr.writer import write_multiscale

from napari_ome_zarr import napari_get_reader
from napari_ome_zarr._reader import napari_get_reader


Expand Down Expand Up @@ -116,3 +121,22 @@ def test_viewer(self, make_napari_viewer):
assert layer.data_level == 2
except AttributeError:
pass
# Check that current level is first large enough to fill the canvas with
# a greater than one pixel depth
assert layer.data_level == 2


def test_single_channel_name(tmp_path: Path):
data = [np.zeros((64, 32)), np.zeros((32, 16))]
zarr_path = tmp_path / "test.zarr"
store = parse_url(zarr_path, mode="w").store
root = zarr.group(store=store)
write_multiscale(data, group=root, name="kermit")

reader = napari_get_reader(zarr_path)
assert reader is not None
layers = reader(zarr_path)

assert len(layers) == 1
_, read_metadata, _ = layers[0]
assert read_metadata["name"] == "kermit"

0 comments on commit 983edb9

Please sign in to comment.