@@ -119,15 +119,46 @@ def test_zoom(self):
119119 self .image .zoom (2 )
120120 assert self .image .zoom_level == 6 # 3 x 2
121121
122- def test_marker_properties (self ):
123- # Set the marker style
124- marker_style = {'color' : 'yellow' , 'radius' : 10 , 'type' : 'cross' }
125- self .image .marker = marker_style
126- m_str = str (self .image .marker )
127- for key in marker_style .keys ():
128- assert key in m_str
129-
130- # TODO: add test that checks that retrieving markers with an unknown name issues no error
122+ def test_set_get_catalog_style_no_labels (self ):
123+ # Check that getting without setting returns a dict that contains
124+ # the minimum required keys
125+ required_style_keys = ['color' , 'shape' , 'size' ]
126+ marker_style = self .image .get_catalog_style ()
127+ for key in required_style_keys :
128+ assert key in marker_style
129+
130+ # Check that setting a marker style works
131+ marker_settings = dict (color = 'red' , marker = 'x' , size = 10 )
132+ self .image .set_catalog_style (** marker_settings )
133+
134+ retrieved_style = self .image .get_catalog_style ()
135+ # Check that the marker style is set correctly
136+ for key , value in marker_settings .items ():
137+ assert retrieved_style [key ] == value
138+
139+ # Check that set accepts the output of get
140+ self .image .set_catalog_style (** retrieved_style )
141+
142+ def test_set_get_catalog_style_with_single_label (self ):
143+ # Check that when there is only a single catalog label it is
144+ # not necessary to provide the label on get.
145+ set_style_input = dict (catalog_label = 'test1' , color = 'blue' ,
146+ shape = 'square' , size = 5 )
147+ self .image .set_catalog_style (** set_style_input )
148+ retrieved_style = self .image .get_catalog_style ()
149+
150+ assert set_style_input == retrieved_style
151+
152+ def test_get_catalog_style_with_multiple_labels_raises_error (self ):
153+ # Check that when there are multiple catalog labels, the
154+ # get_catalog_style method raises an error if no label is given.
155+ self .image .set_catalog_style (catalog_label = 'test1' , color = 'blue' ,
156+ shape = 'square' , size = 5 )
157+ self .image .set_catalog_style (catalog_label = 'test2' , color = 'red' ,
158+ shape = 'circle' , size = 10 )
159+
160+ with pytest .raises (ValueError , match = 'Multiple catalog styles' ):
161+ self .image .get_catalog_style ()
131162
132163 def test_add_markers (self ):
133164 data = np .arange (10 ).reshape (5 , 2 )
0 commit comments