@@ -577,6 +577,10 @@ def test_resolve_object_single(patch_post):
577577 assert isinstance (obj_loc , SkyCoord )
578578 assert round (obj_loc .separation (tic_coord ).value , 10 ) == 0
579579
580+ # Resolve with integer input
581+ obj_loc = mast .Mast .resolve_object (251813740 )
582+ assert isinstance (obj_loc , SkyCoord )
583+
580584 # Resolve using a specific resolver and an object that belongs to a MAST catalog
581585 obj_loc_simbad = mast .Mast .resolve_object (obj , resolver = "SIMBAD" )
582586 assert round (obj_loc_simbad .separation (simbad_coord ).value , 10 ) == 0
@@ -613,39 +617,40 @@ def test_resolve_object_single(patch_post):
613617
614618
615619def test_resolve_object_multi (patch_post ):
616- objects = ["TIC 307210830" , "M1" , "Barnard's Star" ]
620+ objects = ["TIC 307210830" , "M1" , "Barnard's Star" , 251813740 ]
617621
618622 # No resolver specified
619623 coord_dict = mast .Mast .resolve_object (objects )
620624 assert isinstance (coord_dict , dict )
621625 for obj in objects :
622- assert obj in coord_dict
623- assert isinstance (coord_dict [obj ], SkyCoord )
624-
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" ])
626+ obj_str = str (obj )
627+ assert obj_str in coord_dict
628+ assert isinstance (coord_dict [obj_str ], SkyCoord )
628629
629630 # Resolver specified
630- coord_dict = mast .Mast .resolve_object (objects , resolver = "SIMBAD" )
631+ coord_dict = mast .Mast .resolve_object (objects [: 3 ] , resolver = "SIMBAD" )
631632 assert isinstance (coord_dict , dict )
632- for obj in objects :
633+ for obj in objects [: 3 ] :
633634 assert obj in coord_dict
634635 assert isinstance (coord_dict [obj ], SkyCoord )
635636
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-
640637 # Resolve all
641- coord_dict = mast .Mast .resolve_object (objects , resolve_all = True )
638+ coord_dict = mast .Mast .resolve_object (objects [: 3 ] , resolve_all = True )
642639 assert isinstance (coord_dict , dict )
643- for obj in objects :
640+ for obj in objects [: 3 ] :
644641 assert obj in coord_dict
645642 obj_dict = coord_dict [obj ]
646643 assert isinstance (obj_dict , dict )
647644 assert isinstance (obj_dict ["SIMBAD" ], SkyCoord )
648645
646+ # Warn if one of the objects cannot be resolved
647+ with pytest .warns (InputWarning , match = 'Could not resolve "nonexisting" to a sky position.' ):
648+ coord_dict = mast .Mast .resolve_object (["M1" , "nonexisting" ])
649+
650+ # Warn if one of the objects can't be resolved with given resolver
651+ with pytest .warns (InputWarning , match = 'Could not resolve "TIC 307210830" to a sky position using resolver "NED"' ):
652+ mast .Mast .resolve_object (objects [:2 ], resolver = "NED" )
653+
649654 # Error if none of the objects can be resolved
650655 warnings .simplefilter ("ignore" , category = InputWarning ) # ignore warnings
651656 with pytest .raises (ResolverError , match = 'Could not resolve any of the given object names to sky positions.' ):
0 commit comments