Skip to content

Commit c58e9c9

Browse files
committed
Add additional style tests
1 parent 3024aef commit c58e9c9

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/astro_image_display_api/widget_api_test.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def test_set_catalog_style_before_catalog_data_raises_error(self):
143143
ValueError,
144144
match='Must load a catalog before setting a catalog style'
145145
):
146-
self.image.set_catalog_style(color='red', marker='x', size=10)
146+
self.image.set_catalog_style(color='red', shape='x', size=10)
147147

148148
def test_set_get_catalog_style_no_labels(self, catalog):
149149
# Check that getting without setting returns a dict that contains
@@ -157,7 +157,7 @@ def test_set_get_catalog_style_no_labels(self, catalog):
157157
# Add some data before setting a style
158158
self.image.load_catalog(catalog)
159159
# Check that setting a marker style works
160-
marker_settings = dict(color='red', marker='x', size=10)
160+
marker_settings = dict(color='red', shape='x', size=10)
161161
self.image.set_catalog_style(**marker_settings)
162162

163163
retrieved_style = self.image.get_catalog_style()
@@ -192,6 +192,19 @@ def test_get_catalog_style_with_multiple_labels_raises_error(self, catalog):
192192
with pytest.raises(ValueError, match='Multiple catalog styles'):
193193
self.image.get_catalog_style()
194194

195+
def set_get_caralog_style_preserves_extra_keywords(self, catalog):
196+
# Check that setting a catalog style with extra keywords preserves
197+
# those keywords.
198+
self.image.load_catalog(catalog)
199+
# The only required keywords are color, shape, and size.
200+
# Add some extra keyword to the style.
201+
style = dict(color='blue', shape='x', size=10, extra_kw='extra_value', alpha=0.5)
202+
self.image.set_catalog_style(**style)
203+
204+
retrieved_style = self.image.get_catalog_style()
205+
del retrieved_style['catalog_label'] # Remove the label
206+
assert retrieved_style == style
207+
195208
@pytest.mark.parametrize("catalog_label", ['test1', None])
196209
def test_load_get_single_catalog_with_without_label(self, catalog, catalog_label):
197210
# Make sure we can get a single catalog with or without a label.
@@ -353,7 +366,7 @@ def test_load_catalog_with_no_style_has_a_style(self, catalog):
353366
def test_load_catalog_with_style_sets_style(self, catalog):
354367
# Check that loading a catalog with a style sets the style
355368
# for that catalog.
356-
style = dict(color='blue', marker='x', size=10)
369+
style = dict(color='blue', shape='x', size=10)
357370
self.image.load_catalog(catalog, catalog_label='test1',
358371
catalog_style=style)
359372

0 commit comments

Comments
 (0)