Skip to content

Commit bd6b039

Browse files
committed
Add test that catalog style is set when loading a catalog
1 parent 941a6ad commit bd6b039

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
@@ -339,6 +339,27 @@ def test_catalog_info_preserved_after_load(self, catalog):
339339
assert 'extra_info' in retrieved_catalog.colnames
340340
assert (retrieved_catalog['extra_info'] == catalog['extra_info']).all()
341341

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

0 commit comments

Comments
 (0)