Skip to content

Commit 4d15ee9

Browse files
mstcyr2bsipocz
authored andcommitted
mast_query unit tests
1 parent f94614c commit 4d15ee9

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

astroquery/mast/tests/test_mast.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,21 @@ def test_mast_service_request(patch_post):
299299
assert isinstance(result, Table)
300300

301301

302+
def test_mast_query(patch_post):
303+
# cone search
304+
result = mast.Mast.mast_query('Mast.Caom.Cone', ra=23.34086, dec=60.658, radius=0.2)
305+
assert isinstance(result, Table)
306+
307+
# filtered search
308+
result = mast.Mast.mast_query('Mast.Caom.Filtered',
309+
dataproduct_type=['image'],
310+
proposal_pi=['Osten, Rachel A.'],
311+
s_dec=[{'min': 43.5, 'max': 45.5}])
312+
assert isinstance(result, Table)
313+
314+
# filtered search with position
315+
316+
302317
def test_resolve_object(patch_post):
303318
m103_loc = mast.Mast.resolve_object("M103")
304319
print(m103_loc)

astroquery/mast/tests/test_mast_remote.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ def test_mast_service_request(self):
8383
# Are the two GALEX observations with obs_id 6374399093149532160 in the results table
8484
assert len(result[np.where(result["obs_id"] == "6374399093149532160")]) == 2
8585

86+
def test_mast_query(self):
87+
# clear columns config
88+
mast.Mast._column_configs = dict()
89+
90+
result = mast.Mast.mast_query('Mast.Caom.Cone', ra=184.3, dec=54.5, radius=0.2)
91+
92+
# Is result in the right format
93+
assert isinstance(result, Table)
94+
95+
# Are the GALEX observations in the results table
96+
assert "GALEX" in result['obs_collection']
97+
98+
# Are the two GALEX observations with obs_id 6374399093149532160 in the results table
99+
assert len(result[np.where(result["obs_id"] == "6374399093149532160")]) == 2
100+
86101
def test_mast_session_info(self):
87102
sessionInfo = mast.Mast.session_info(verbose=False)
88103
assert sessionInfo['ezid'] == 'anonymous'

0 commit comments

Comments
 (0)