Skip to content

Commit 18e90e5

Browse files
committed
Add additional style tests
1 parent 5a3213d commit 18e90e5

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
@@ -142,7 +142,7 @@ def test_set_catalog_style_before_catalog_data_raises_error(self):
142142
ValueError,
143143
match='Must load a catalog before setting a catalog style'
144144
):
145-
self.image.set_catalog_style(color='red', marker='x', size=10)
145+
self.image.set_catalog_style(color='red', shape='x', size=10)
146146

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

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

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

0 commit comments

Comments
 (0)