Skip to content

Commit 6f7796f

Browse files
timtreisclaude
andcommitted
Align label color tests with points/shapes conventions
Replace the 3 ad-hoc tests (color_name, hex, rgba_tuple) with 4 tests that mirror the existing points and shapes pattern: rgba_array, hex, hex_with_alpha, and alpha_overwrites_opacity_from_color. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2bdd685 commit 6f7796f

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed
-36.4 KB
Binary file not shown.
-36.4 KB
Binary file not shown.
-36.4 KB
Binary file not shown.

tests/pl/test_render_labels.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,17 @@ def test_plot_can_stack_render_labels(self, sdata_blobs: SpatialData):
8484
.pl.show()
8585
)
8686

87-
def test_plot_can_color_by_color_name(self, sdata_blobs: SpatialData):
88-
sdata_blobs.pl.render_labels("blobs_labels", color="red").pl.show()
87+
def test_plot_can_color_by_rgba_array(self, sdata_blobs: SpatialData):
88+
sdata_blobs.pl.render_labels("blobs_labels", color=[0.5, 0.5, 1.0, 0.5]).pl.show()
8989

9090
def test_plot_can_color_by_hex(self, sdata_blobs: SpatialData):
91-
sdata_blobs.pl.render_labels("blobs_labels", color="#ff0000").pl.show()
91+
sdata_blobs.pl.render_labels("blobs_labels", color="#88a136").pl.show()
9292

93-
def test_plot_can_color_by_rgba_tuple(self, sdata_blobs: SpatialData):
94-
sdata_blobs.pl.render_labels("blobs_labels", color=(1.0, 0.0, 0.0, 0.5)).pl.show()
93+
def test_plot_can_color_by_hex_with_alpha(self, sdata_blobs: SpatialData):
94+
sdata_blobs.pl.render_labels("blobs_labels", color="#88a13688").pl.show()
95+
96+
def test_plot_alpha_overwrites_opacity_from_color(self, sdata_blobs: SpatialData):
97+
sdata_blobs.pl.render_labels("blobs_labels", color=[0.5, 0.5, 1.0, 0.5], fill_alpha=1.0).pl.show()
9598

9699
def test_plot_can_color_labels_by_continuous_variable(self, sdata_blobs: SpatialData):
97100
sdata_blobs.pl.render_labels("blobs_labels", color="channel_0_sum").pl.show()

0 commit comments

Comments
 (0)