Skip to content

Commit

Permalink
mast_query unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mstcyr2 authored and bsipocz committed Jan 28, 2024
1 parent f94614c commit 4d15ee9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions astroquery/mast/tests/test_mast.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,21 @@ def test_mast_service_request(patch_post):
assert isinstance(result, Table)


def test_mast_query(patch_post):
# cone search
result = mast.Mast.mast_query('Mast.Caom.Cone', ra=23.34086, dec=60.658, radius=0.2)
assert isinstance(result, Table)

# filtered search
result = mast.Mast.mast_query('Mast.Caom.Filtered',
dataproduct_type=['image'],
proposal_pi=['Osten, Rachel A.'],
s_dec=[{'min': 43.5, 'max': 45.5}])
assert isinstance(result, Table)

# filtered search with position


def test_resolve_object(patch_post):
m103_loc = mast.Mast.resolve_object("M103")
print(m103_loc)
Expand Down
15 changes: 15 additions & 0 deletions astroquery/mast/tests/test_mast_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ def test_mast_service_request(self):
# Are the two GALEX observations with obs_id 6374399093149532160 in the results table
assert len(result[np.where(result["obs_id"] == "6374399093149532160")]) == 2

def test_mast_query(self):
# clear columns config
mast.Mast._column_configs = dict()

result = mast.Mast.mast_query('Mast.Caom.Cone', ra=184.3, dec=54.5, radius=0.2)

# Is result in the right format
assert isinstance(result, Table)

# Are the GALEX observations in the results table
assert "GALEX" in result['obs_collection']

# Are the two GALEX observations with obs_id 6374399093149532160 in the results table
assert len(result[np.where(result["obs_id"] == "6374399093149532160")]) == 2

def test_mast_session_info(self):
sessionInfo = mast.Mast.session_info(verbose=False)
assert sessionInfo['ezid'] == 'anonymous'
Expand Down

0 comments on commit 4d15ee9

Please sign in to comment.