Skip to content

Commit 68a7a33

Browse files
committed
ENH: Test validate_color
1 parent abc2edc commit 68a7a33

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_omero.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pytest
12
import numpy as np
23
from zarr.storage import MemoryStore
34
from ngff_zarr import (
@@ -99,3 +100,17 @@ def test_write_omero():
99100
assert read_omero.channels[1].color == "0000FF"
100101
assert read_omero.channels[1].window.start == 30.0
101102
assert read_omero.channels[1].window.end == 200.0
103+
104+
105+
def test_validate_color():
106+
valid_channel = OmeroChannel(
107+
color="1A2B3C", window=OmeroWindow(min=0.0, max=255.0, start=0.0, end=100.0)
108+
)
109+
# This should not raise an error
110+
valid_channel.validate_color()
111+
112+
invalid_channel = OmeroChannel(
113+
color="ZZZZZZ", window=OmeroWindow(min=0.0, max=255.0, start=0.0, end=100.0)
114+
)
115+
with pytest.raises(ValueError, match=r"Invalid color 'ZZZZZZ'"):
116+
invalid_channel.validate_color()

0 commit comments

Comments
 (0)