@@ -174,12 +174,12 @@ def test_marking_operations(self):
174174 self .image .start_marking ()
175175 assert not self .image .click_drag
176176
177- # Simulate a mouse click to add default marker name to the list.
178- try :
179- self . image . _mouse_click_cb ( self . image . viewer , None , 50 , 50 )
180- assert self . image . get_marker_names () == [ self .image ._interactive_marker_set_name , 'markymark' ]
181- except AttributeError :
182- pass
177+ # Add a marker to the interactive marking table
178+ self . image . add_markers (
179+ Table ( data = [[ 50 ], [ 50 ]], names = [ 'x' , 'y' ], dtype = ( 'float' , 'float' )),
180+ marker_name = self .image .DEFAULT_INTERACTIVE_MARKER_NAME ,
181+ )
182+ assert self . _get_marker_names_as_set () == set ([ self . image . DEFAULT_INTERACTIVE_MARKER_NAME ])
183183
184184 # Clear markers to not pollute other tests.
185185 self .image .stop_marking (clear_markers = True )
@@ -188,21 +188,22 @@ def test_marking_operations(self):
188188 self ._check_empty_marker_table_return_properties (self .image .get_markers (marker_name = "all" ))
189189
190190 # Hate this, should add to public API
191- marknames = self .image . _marktags
191+ marknames = self ._get_marker_names_as_set ()
192192 assert len (marknames ) == 0
193193
194194 # Make sure that click_drag is restored as expected
195195 assert self .image .click_drag
196196
197197 def test_add_markers (self ):
198+ original_marker_name = self .image .DEFAULT_MARKER_NAME
198199 data = np .arange (10 ).reshape (5 , 2 )
199200 orig_tab = Table (data = data , names = ['x' , 'y' ], dtype = ('float' , 'float' ))
200201 tab = Table (data = data , names = ['x' , 'y' ], dtype = ('float' , 'float' ))
201202 self .image .add_markers (tab , x_colname = 'x' , y_colname = 'y' ,
202203 skycoord_colname = 'coord' , marker_name = 'test1' )
203204
204205 # Make sure setting didn't change the default name
205- assert self .image ._default_mark_tag_name == 'default-marker-name'
206+ assert self .image .DEFAULT_MARKER_NAME == original_marker_name
206207
207208 # Regression test for GitHub Issue 45:
208209 # Adding markers should not modify the input data table.
@@ -212,7 +213,7 @@ def test_add_markers(self):
212213 self .image .add_markers (tab , x_colname = 'x' , y_colname = 'y' ,
213214 skycoord_colname = 'coord' , marker_name = 'test2' )
214215
215- marknames = self .image . _marktags
216+ marknames = self ._get_marker_names_as_set ()
216217 assert marknames == set (['test1' , 'test2' ])
217218 # assert self.image.get_marker_names() == ['test1', 'test2']
218219
@@ -234,7 +235,7 @@ def test_add_markers(self):
234235 assert (t2 ['y' ] == expected ['y' ]).all ()
235236
236237 self .image .remove_markers (marker_name = 'test1' )
237- marknames = self .image . _marktags
238+ marknames = self ._get_marker_names_as_set ()
238239 assert marknames == set (['test2' ])
239240 # assert self.image.get_marker_names() == ['test2']
240241
@@ -249,14 +250,12 @@ def test_add_markers(self):
249250 skycoord_colname = 'coord' )
250251 # Don't care about the order of the marker names so use set instead of
251252 # list.
252- marknames = self .image ._marktags
253- assert (set (marknames ) == set (['test2' , self .image ._default_mark_tag_name ]))
254- # assert (set(self.image.get_marker_names()) ==
255- # set(['test2', self.image._default_mark_tag_name]))
253+ marknames = self ._get_marker_names_as_set ()
254+ assert (set (marknames ) == set (['test2' , self .image .DEFAULT_MARKER_NAME ]))
256255
257256 # Clear markers to not pollute other tests.
258257 self .image .reset_markers ()
259- marknames = self .image . _marktags
258+ marknames = self ._get_marker_names_as_set ()
260259 assert len (marknames ) == 0
261260 self ._check_empty_marker_table_return_properties (self .image .get_markers (marker_name = "all" ))
262261 # Check that no markers remain after clearing
@@ -391,10 +390,10 @@ def test_click_drag(self):
391390
392391 # If is_marking is true then trying to enable click_drag should fail
393392 self .image .click_drag = False
394- self .image ._is_marking = True
395- with pytest .raises (ValueError , match = r'([Ii]nteractive marking)|(while in marking mode)' ):
393+ self .image .start_marking ()
394+ with pytest .raises (ValueError , match = r'([Ii]nteractive marking)|(while in marking mode)|(while marking is active) ' ):
396395 self .image .click_drag = True
397- self .image ._is_marking = False
396+ self .image .stop_marking ()
398397
399398 def test_click_center (self ):
400399 # Set this to ensure that click_center turns it off
@@ -408,12 +407,12 @@ def test_click_center(self):
408407 self .image .click_center = True
409408 assert not self .image .click_drag
410409
411- # If is_marking is true then trying to enable click_center should fail
412- self .image ._is_marking = True
413410 self .image .click_center = False
414- with pytest .raises (ValueError , match = r'([Ii]nteractive marking)|(while in marking mode)' ):
411+ # If is_marking is true then trying to enable click_center should fail
412+ self .image .start_marking ()
413+ with pytest .raises (ValueError , match = r'([Ii]nteractive marking)|(while marking is active)' ):
415414 self .image .click_center = True
416- self .image ._is_marking = False
415+ self .image .stop_marking ()
417416
418417 def test_scroll_pan (self ):
419418 # Make sure scroll_pan is actually settable
0 commit comments