@@ -1256,3 +1256,37 @@ def test_zcut_get_cutouts(patch_post, tmpdir):
1256
1256
assert isinstance (cutout_list , list )
1257
1257
assert len (cutout_list ) == 1
1258
1258
assert isinstance (cutout_list [0 ], fits .HDUList )
1259
+
1260
+
1261
+ ################
1262
+ # Utils tests #
1263
+ ################
1264
+
1265
+
1266
+ def test_parse_input_location (patch_post ):
1267
+ # Test with coordinates
1268
+ coord = SkyCoord (23.34086 , 60.658 , unit = "deg" )
1269
+ loc = mast .utils .parse_input_location (coordinates = coord )
1270
+ assert isinstance (loc , SkyCoord )
1271
+ assert loc .ra == coord .ra
1272
+ assert loc .dec == coord .dec
1273
+
1274
+ # Test with object name
1275
+ obj_coord = SkyCoord (124.531756290083 , - 68.3129998725044 , unit = "deg" )
1276
+ loc = mast .utils .parse_input_location (objectname = "TIC 307210830" )
1277
+ assert isinstance (loc , SkyCoord )
1278
+ assert loc .ra == obj_coord .ra
1279
+ assert loc .dec == obj_coord .dec
1280
+
1281
+ # Error if both coordinates and object name are provided
1282
+ with pytest .raises (InvalidQueryError , match = "Only one of objectname and coordinates may be specified" ):
1283
+ mast .utils .parse_input_location (coordinates = coord , objectname = "M101" )
1284
+
1285
+ # Error if neither coordinates nor object name is provided
1286
+ with pytest .raises (InvalidQueryError , match = "One of objectname and coordinates must be specified" ):
1287
+ mast .utils .parse_input_location ()
1288
+
1289
+ # Warn if resolver is specified without an object name
1290
+ with pytest .warns (InputWarning , match = "Resolver is only used when resolving object names" ):
1291
+ loc = mast .utils .parse_input_location (coordinates = coord , resolver = "SIMBAD" )
1292
+ assert isinstance (loc , SkyCoord )
0 commit comments