Skip to content

Commit 2bafd7b

Browse files
committed
Add test that catalog style is set when loading a catalog
1 parent f2a2e7c commit 2bafd7b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/astro_image_display_api/widget_api_test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,27 @@ def test_catalog_info_preserved_after_load(self, catalog):
337337
assert 'extra_info' in retrieved_catalog.colnames
338338
assert (retrieved_catalog['extra_info'] == catalog['extra_info']).all()
339339

340+
def test_load_catalog_with_no_style_has_a_style(self, catalog):
341+
# Check that loading a catalog without a style sets a default style
342+
# for that catalog.
343+
self.image.load_catalog(catalog, catalog_label='test1')
344+
345+
retrieved_style = self.image.get_catalog_style(catalog_label='test1')
346+
assert isinstance(retrieved_style, dict)
347+
assert 'color' in retrieved_style
348+
assert 'shape' in retrieved_style
349+
assert 'size' in retrieved_style
350+
351+
def test_load_catalog_with_style_sets_style(self, catalog):
352+
# Check that loading a catalog with a style sets the style
353+
# for that catalog.
354+
style = dict(color='blue', marker='x', size=10)
355+
self.image.load_catalog(catalog, catalog_label='test1',
356+
catalog_style=style)
357+
358+
retrieved_style = self.image.get_catalog_style(catalog_label='test1')
359+
assert retrieved_style == style
360+
340361
def test_remove_catalog(self):
341362
with pytest.raises(ValueError, match='arf'):
342363
self.image.remove_catalog(catalog_label='arf')

0 commit comments

Comments
 (0)