Skip to content

Commit 5acd0f7

Browse files
committed
Fix test for preservation of catalog style keywords
1 parent 9870657 commit 5acd0f7

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
@@ -181,20 +181,17 @@ def set_catalog_style(
181181
**kwargs
182182
Additional keyword arguments to pass to the marker style.
183183
"""
184-
shape = shape
185-
color = color
186-
size = size
187-
188184
catalog_label = self._resolve_catalog_label(catalog_label)
189185

190186
if self._catalogs[catalog_label].data is None:
191187
raise ValueError("Must load a catalog before setting a catalog style.")
192188

193-
self._catalogs[catalog_label].style = {
194-
"shape": shape,
195-
"color": color,
196-
"size": size,
197-
}
189+
self._catalogs[catalog_label].style = dict(
190+
shape=shape,
191+
color=color,
192+
size=size,
193+
**kwargs
194+
)
198195

199196
# Methods for loading data
200197
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
@@ -191,14 +191,14 @@ 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):
194+
def test_set_get_catalog_style_preserves_extra_keywords(self, catalog):
195195
# Check that setting a catalog style with extra keywords preserves
196196
# those keywords.
197197
self.image.load_catalog(catalog)
198198
# The only required keywords are color, shape, and size.
199199
# Add some extra keyword to the style.
200200
style = dict(color='blue', shape='x', size=10, extra_kw='extra_value', alpha=0.5)
201-
self.image.set_catalog_style(**style)
201+
self.image.set_catalog_style(**style.copy())
202202

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

0 commit comments

Comments
 (0)