Skip to content

Commit a5fd498

Browse files
committed
updated tests
1 parent c07baf5 commit a5fd498

8 files changed

Lines changed: 11 additions & 20 deletions
92.2 KB
Loading
85.5 KB
Loading
85.5 KB
Loading
92.1 KB
Loading
69.8 KB
Loading
72.5 KB
Loading
2.36 KB
Loading

tests/pl/test_render_images.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ def test_plot_can_pass_cmap_list(self, sdata_blobs: SpatialData):
4343
cmap=[matplotlib.colormaps["seismic"], matplotlib.colormaps["Reds"], matplotlib.colormaps["Blues"]],
4444
).pl.show()
4545

46-
def test_plot_can_render_a_single_channel_from_image(self, sdata_blobs: SpatialData):
47-
sdata_blobs.pl.render_images(element="blobs_image", channel=0).pl.show()
48-
4946
def test_plot_can_render_a_single_channel_from_multiscale_image(self, sdata_blobs: SpatialData):
5047
sdata_blobs.pl.render_images(element="blobs_multiscale_image", channel=0).pl.show()
5148

@@ -85,11 +82,6 @@ def test_plot_can_pass_color_to_single_channel(self, sdata_blobs: SpatialData):
8582
def test_plot_can_pass_cmap_to_single_channel(self, sdata_blobs: SpatialData):
8683
sdata_blobs.pl.render_images(element="blobs_image", channel=1, cmap="Reds").pl.show()
8784

88-
def test_plot_can_pass_color_to_each_channel(self, sdata_blobs: SpatialData):
89-
sdata_blobs.pl.render_images(
90-
element="blobs_image", channel=[0, 1, 2], palette=["red", "green", "blue"]
91-
).pl.show()
92-
9385
def test_plot_can_pass_cmap_to_each_channel(self, sdata_blobs: SpatialData):
9486
sdata_blobs.pl.render_images(
9587
element="blobs_image", channel=[0, 1, 2], cmap=["Reds", "Greens", "Blues"]
@@ -162,7 +154,7 @@ def test_plot_can_handle_single_channel_default_color(self, sdata_blobs: Spatial
162154

163155
def test_plot_can_handle_single_channel_with_cmap(self, sdata_blobs: SpatialData):
164156
"""Test that a single channel can use a cmap instead of a palette color"""
165-
sdata_blobs.pl.render_images(element="blobs_image", channel=0, cmap="viridis").pl.show()
157+
sdata_blobs.pl.render_images(element="blobs_image", channel=0, cmap="Reds").pl.show()
166158

167159
def test_plot_can_handle_mixed_color_types(self, sdata_blobs: SpatialData):
168160
"""Test that different channels can use different color types (palette colors and cmaps)"""
@@ -175,7 +167,7 @@ def test_plot_can_handle_one_channel(self, sdata_blobs: SpatialData):
175167

176168
def test_plot_can_handle_subset_of_channels(self, sdata_blobs: SpatialData):
177169
"""Test case 2A: 3 channels with default RGB mapping"""
178-
sdata_blobs.pl.render_images(element="blobs_image", channel=[0, 1, 2]).pl.show()
170+
sdata_blobs.pl.render_images(element="blobs_image", channel=[0, 2]).pl.show()
179171

180172
def test_plot_can_handle_actual_number_of_channels(self, sdata_blobs: SpatialData):
181173
"""Test case 2A: 3 channels with default RGB mapping"""
@@ -194,17 +186,16 @@ def test_plot_can_handle_multiple_channels_pca_strategy(self, sdata_multichannel
194186
sdata_multichannel.pl.render_images(element="multichannel_image", multichannel_strategy="pca").pl.show()
195187

196188
def test_plot_can_handle_multiple_cmaps(self, sdata_blobs: SpatialData):
197-
"""Test case 2D: Multiple channels with multiple cmaps"""
198189
sdata_blobs.pl.render_images(
199190
element="blobs_image", channel=[0, 1, 2], cmap=["viridis", "Reds", "Blues"]
200191
).pl.show()
201192

202-
def test_plot_fails_with_palette_and_multiple_cmaps(self, sdata_blobs: SpatialData):
203-
"""Test error case: Cannot provide both palette and multiple cmaps"""
204-
with pytest.raises(ValueError, match="If 'palette' is provided"):
205-
sdata_blobs.pl.render_images(
206-
element="blobs_image",
207-
channel=[0, 1, 2],
208-
palette=["red", "green", "blue"],
209-
cmap=["viridis", "Reds", "Blues"],
210-
).pl.show()
193+
def test_fails_with_palette_and_multiple_cmaps(self, sdata_blobs: SpatialData):
194+
"""Test error case: Cannot provide both palette and multiple cmaps"""
195+
with pytest.raises(ValueError, match="If 'palette' is provided"):
196+
sdata_blobs.pl.render_images(
197+
element="blobs_image",
198+
channel=[0, 1, 2],
199+
palette=["red", "green", "blue"],
200+
cmap=["viridis", "Reds", "Blues"],
201+
).pl.show()

0 commit comments

Comments
 (0)