@@ -197,15 +197,54 @@ def test_query_region(self):
197197 sc = SkyCoord (ra = 29.0 , dec = 15.0 , unit = (u .degree , u .degree ), frame = 'icrs' )
198198 with pytest .raises (ValueError ) as err :
199199 tap .query_region (sc )
200+ print (err .value .args [0 ])
200201 assert "Missing required argument: 'width'" in err .value .args [0 ]
201202
202203 width = Quantity (12 , u .deg )
204+ height = Quantity (10 , u .deg )
203205
204206 with pytest .raises (ValueError ) as err :
205207 tap .query_region (sc , width = width )
206208 assert "Missing required argument: 'height'" in err .value .args [0 ]
207209
208- height = Quantity (10 , u .deg )
210+ #Test cal_level argument
211+ with pytest .raises (ValueError ) as err :
212+ tap .query_region (sc , width = width , height = height , cal_level = 'a' )
213+ assert "cal_level must be either 'Top' or an integer" in err .value .args [0 ]
214+
215+ #Test only_public
216+ with pytest .raises (ValueError ) as err :
217+ tap .query_region (sc , width = width , height = height , only_public = 'a' )
218+ assert "only_public must be boolean" in err .value .args [0 ]
219+
220+ #Test dataproduct_type argument
221+ with pytest .raises (ValueError ) as err :
222+ tap .query_region (sc , width = width , height = height , prod_type = 1 )
223+ assert "prod_type must be string" in err .value .args [0 ]
224+
225+ with pytest .raises (ValueError ) as err :
226+ tap .query_region (sc , width = width , height = height , prod_type = 'a' )
227+ assert "prod_type must be one of: " in err .value .args [0 ]
228+
229+ #Test instrument_name argument
230+ with pytest .raises (ValueError ) as err :
231+ tap .query_region (sc , width = width , height = height , instrument_name = 1 )
232+ assert "instrument_name must be string" in err .value .args [0 ]
233+
234+ with pytest .raises (ValueError ) as err :
235+ tap .query_region (sc , width = width , height = height , instrument_name = 'a' )
236+ assert "instrument_name must be one of: " in err .value .args [0 ]
237+
238+ #Test filter_name argument
239+ with pytest .raises (ValueError ) as err :
240+ tap .query_region (sc , width = width , height = height , filter_name = 1 )
241+ assert "filter_name must be string" in err .value .args [0 ]
242+
243+ #Test proposal_id argument
244+ with pytest .raises (ValueError ) as err :
245+ tap .query_region (sc , width = width , height = height , proposal_id = 'a' )
246+ assert "proposal_id must be an integer" in err .value .args [0 ]
247+
209248 table = tap .query_region (sc , width = width , height = height )
210249 assert len (table ) == 3 , \
211250 "Wrong job results (num rows). Expected: %d, found %d" % \
@@ -403,6 +442,45 @@ def test_cone_search_sync(self):
403442 None ,
404443 np .int32 )
405444
445+ #Test cal_level argument
446+ with pytest .raises (ValueError ) as err :
447+ tap .cone_search (sc , radius , cal_level = 'a' )
448+ assert "cal_level must be either 'Top' or an integer" in err .value .args [0 ]
449+
450+ #Test only_public
451+ with pytest .raises (ValueError ) as err :
452+ tap .cone_search (sc , radius , only_public = 'a' )
453+ assert "only_public must be boolean" in err .value .args [0 ]
454+
455+ #Test dataproduct_type argument
456+ with pytest .raises (ValueError ) as err :
457+ tap .cone_search (sc , radius , prod_type = 1 )
458+ assert "prod_type must be string" in err .value .args [0 ]
459+
460+ with pytest .raises (ValueError ) as err :
461+ tap .cone_search (sc , radius , prod_type = 'a' )
462+ assert "prod_type must be one of: " in err .value .args [0 ]
463+
464+ #Test instrument_name argument
465+ with pytest .raises (ValueError ) as err :
466+ tap .cone_search (sc , radius , instrument_name = 1 )
467+ assert "instrument_name must be string" in err .value .args [0 ]
468+
469+ with pytest .raises (ValueError ) as err :
470+ tap .cone_search (sc , radius , instrument_name = 'a' )
471+ assert "instrument_name must be one of: " in err .value .args [0 ]
472+
473+ #Test filter_name argument
474+ with pytest .raises (ValueError ) as err :
475+ tap .cone_search (sc , radius , filter_name = 1 )
476+ assert "filter_name must be string" in err .value .args [0 ]
477+
478+ #Test proposal_id argument
479+ with pytest .raises (ValueError ) as err :
480+ tap .cone_search (sc , radius , proposal_id = 'a' )
481+ assert "proposal_id must be an integer" in err .value .args [0 ]
482+
483+
406484 def test_cone_search_async (self ):
407485 connHandler = DummyConnHandler ()
408486 tapplus = TapPlus ("http://test:1111/tap" , connhandler = connHandler )
0 commit comments