Skip to content

Commit 2d4061a

Browse files
committed
Fix test for preservation of catalog style keywords
1 parent ca9a4a5 commit 2d4061a

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/astro_image_display_api/dummy_viewer.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,17 @@ def set_catalog_style(
171171
**kwargs
172172
Additional keyword arguments to pass to the marker style.
173173
"""
174-
shape = shape
175-
color = color
176-
size = size
177-
178174
catalog_label = self._resolve_catalog_label(catalog_label)
179175

180176
if self._catalogs[catalog_label].data is None:
181177
raise ValueError("Must load a catalog before setting a catalog style.")
182178

183-
self._catalogs[catalog_label].style = {
184-
"shape": shape,
185-
"color": color,
186-
"size": size,
187-
}
179+
self._catalogs[catalog_label].style = dict(
180+
shape=shape,
181+
color=color,
182+
size=size,
183+
**kwargs
184+
)
188185

189186
# Methods for loading data
190187
def load_image(self, file: str | os.PathLike | ArrayLike | NDData) -> None:

src/astro_image_display_api/widget_api_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ 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):
195+
def test_set_get_catalog_style_preserves_extra_keywords(self, catalog):
196196
# Check that setting a catalog style with extra keywords preserves
197197
# those keywords.
198198
self.image.load_catalog(catalog)
199199
# The only required keywords are color, shape, and size.
200200
# Add some extra keyword to the style.
201201
style = dict(color='blue', shape='x', size=10, extra_kw='extra_value', alpha=0.5)
202-
self.image.set_catalog_style(**style)
202+
self.image.set_catalog_style(**style.copy())
203203

204204
retrieved_style = self.image.get_catalog_style()
205205
del retrieved_style['catalog_label'] # Remove the label

0 commit comments

Comments
 (0)