@@ -601,6 +601,10 @@ def test_resolve_object_single(patch_post):
601601 with pytest .raises (ResolverError , match = 'Could not resolve "nonexisting" to a sky position.' ):
602602 mast .Mast .resolve_object ("nonexisting" )
603603
604+ # Error if object is not a string
605+ with pytest .raises (InvalidQueryError , match = 'All object names must be strings.' ):
606+ mast .Mast .resolve_object (1 )
607+
604608 # Error if single object cannot be resolved with given resolver
605609 with pytest .raises (ResolverError , match = 'Could not resolve "Barnard\' s Star" to a sky position using '
606610 'resolver "NED".' ):
@@ -622,21 +626,13 @@ def test_resolve_object_multi(patch_post):
622626 assert obj in coord_dict
623627 assert isinstance (coord_dict [obj ], SkyCoord )
624628
625- # Warn if one of the objects cannot be resolved
626- with pytest .warns (InputWarning , match = 'Could not resolve "nonexisting" to a sky position.' ):
627- coord_dict = mast .Mast .resolve_object (["M1" , "nonexisting" ])
628-
629629 # Resolver specified
630630 coord_dict = mast .Mast .resolve_object (objects , resolver = "SIMBAD" )
631631 assert isinstance (coord_dict , dict )
632632 for obj in objects :
633633 assert obj in coord_dict
634634 assert isinstance (coord_dict [obj ], SkyCoord )
635635
636- # Warn if one of the objects can't be resolved with given resolver
637- with pytest .warns (InputWarning , match = 'Could not resolve "TIC 307210830" to a sky position using resolver "NED"' ):
638- mast .Mast .resolve_object (objects [:2 ], resolver = "NED" )
639-
640636 # Resolve all
641637 coord_dict = mast .Mast .resolve_object (objects , resolve_all = True )
642638 assert isinstance (coord_dict , dict )
@@ -646,6 +642,14 @@ def test_resolve_object_multi(patch_post):
646642 assert isinstance (obj_dict , dict )
647643 assert isinstance (obj_dict ["SIMBAD" ], SkyCoord )
648644
645+ # Warn if one of the objects cannot be resolved
646+ with pytest .warns (InputWarning , match = 'Could not resolve "nonexisting" to a sky position.' ):
647+ coord_dict = mast .Mast .resolve_object (["M1" , "nonexisting" ])
648+
649+ # Warn if one of the objects can't be resolved with given resolver
650+ with pytest .warns (InputWarning , match = 'Could not resolve "TIC 307210830" to a sky position using resolver "NED"' ):
651+ mast .Mast .resolve_object (objects [:2 ], resolver = "NED" )
652+
649653 # Error if none of the objects can be resolved
650654 warnings .simplefilter ("ignore" , category = InputWarning ) # ignore warnings
651655 with pytest .raises (ResolverError , match = 'Could not resolve any of the given object names to sky positions.' ):
0 commit comments