@@ -274,6 +274,17 @@ def test_observations_query_criteria(self):
274
274
intentType = "calibration" )
275
275
assert (result ["intentType" ] == "calibration" ).all ()
276
276
277
+ def test_observations_query_criteria_invalid_keyword (self ):
278
+ # attempt to make a criteria query with invalid keyword
279
+ with pytest .raises (InvalidQueryError ) as err_no_alt :
280
+ Observations .query_criteria_count (not_a_keyword = 'TESS' )
281
+ assert 'Filter not_a_keyword does not exist.' in str (err_no_alt .value )
282
+
283
+ # keyword is close enough for difflib to offer alternative
284
+ with pytest .raises (InvalidQueryError ) as err_with_alt :
285
+ Observations .query_criteria_count (oops_collection = 'TESS' )
286
+ assert 'obs_collection' in str (err_with_alt .value )
287
+
277
288
# count functions
278
289
def test_observations_query_region_count (self ):
279
290
maxRes = Observations .query_criteria_count ()
@@ -881,6 +892,17 @@ def check_result(result, exp_vals):
881
892
assert isinstance (result , Table )
882
893
assert result ['distance' ][0 ] <= result ['distance' ][1 ]
883
894
895
+ def test_catalogs_query_criteria_invalid_keyword (self ):
896
+ # attempt to make a criteria query with invalid keyword
897
+ with pytest .raises (InvalidQueryError ) as err_no_alt :
898
+ Catalogs .query_criteria (catalog = 'tic' , not_a_keyword = 'TESS' )
899
+ assert 'Filter not_a_keyword does not exist.' in str (err_no_alt .value )
900
+
901
+ # keyword is close enough for difflib to offer alternative
902
+ with pytest .raises (InvalidQueryError ) as err_with_alt :
903
+ Catalogs .query_criteria (catalog = 'ctl' , objectType = "STAR" )
904
+ assert 'objType' in str (err_with_alt .value )
905
+
884
906
def test_catalogs_query_hsc_matchid_async (self ):
885
907
catalogData = Catalogs .query_object ("M10" ,
886
908
radius = .001 ,
0 commit comments