Skip to content

Commit

Permalink
ENH: Test validate_color
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jan 10, 2025
1 parent abc2edc commit 68a7a33
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_omero.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
import numpy as np
from zarr.storage import MemoryStore
from ngff_zarr import (
Expand Down Expand Up @@ -99,3 +100,17 @@ def test_write_omero():
assert read_omero.channels[1].color == "0000FF"
assert read_omero.channels[1].window.start == 30.0
assert read_omero.channels[1].window.end == 200.0


def test_validate_color():
valid_channel = OmeroChannel(
color="1A2B3C", window=OmeroWindow(min=0.0, max=255.0, start=0.0, end=100.0)
)
# This should not raise an error
valid_channel.validate_color()

invalid_channel = OmeroChannel(
color="ZZZZZZ", window=OmeroWindow(min=0.0, max=255.0, start=0.0, end=100.0)
)
with pytest.raises(ValueError, match=r"Invalid color 'ZZZZZZ'"):
invalid_channel.validate_color()

0 comments on commit 68a7a33

Please sign in to comment.