Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
54a0496
added mast.astroquery wrapper for missions mast search API
syed-gilani Jun 23, 2021
1fff68d
added a unit test
syed-gilani Jun 23, 2021
aeefbed
fixed a few issues
syed-gilani Jun 24, 2021
e976c5a
added docs and fixed unit test
syed-gilani Jun 24, 2021
9962691
fixed pylint issues
syed-gilani Jun 24, 2021
86fb669
removed whitespaces
syed-gilani Jun 24, 2021
0a8c146
fixed a syntax issue
syed-gilani Jun 24, 2021
7b9e9f9
updated the docs
syed-gilani Jun 24, 2021
b064d57
fixed a few issues
syed-gilani Jun 25, 2021
9bf6a98
added missions_mast file
syed-gilani Jul 1, 2021
67af009
added query_ methods to missions_mast
syed-gilani Jul 2, 2021
80bbf5e
added some more unit tests
syed-gilani Jul 7, 2021
7aa1439
added unit tests for query_criteria
syed-gilani Jul 8, 2021
e8ec621
cleaned up doc strings
syed-gilani Jul 8, 2021
960bc8a
changed the class name from MissionsMastClass to MissionsClass
syed-gilani Jul 8, 2021
87d4b56
changed the missions mast server URL to test
syed-gilani Jul 14, 2021
53a5321
renmamed a file
syed-gilani Jul 22, 2021
e3242e5
moved a fiel that is not needed and some other minor changes
syed-gilani Sep 21, 2021
a5176ef
changed the server name to mast.stsci.edu
syed-gilani Sep 21, 2021
5dcae22
code cleanup
syed-gilani Sep 27, 2021
173b9c5
fix code style errors
syed-gilani Sep 28, 2021
1be3f9d
added missing doc strings and updated the code examples
syed-gilani Oct 8, 2021
db8f581
fixed code style issues
syed-gilani Oct 8, 2021
1949f0f
updted documentation with more examples and fixed an issue with addin…
syed-gilani Oct 12, 2021
977097e
changed class name from Missions to MissionsMast
syed-gilani Oct 15, 2021
98b63a2
replaced relative imports with absolute imports
syed-gilani Oct 15, 2021
9d13269
fixed indentation issue and added a missing import
syed-gilani Oct 15, 2021
cc11223
fixed indentation and updated doc string
syed-gilani Oct 15, 2021
eda0e66
fixed a failing test
syed-gilani Oct 15, 2021
b3a9594
removed the set methods for service and mission
syed-gilani Oct 21, 2021
858c916
replaced relative imports with absolute imports
syed-gilani Oct 21, 2021
4ad97b8
changed class name from MissionsMast to MastMissions
syed-gilani Oct 21, 2021
975ae1a
made all data type comparisons in lower case and added comments about…
syed-gilani Oct 21, 2021
27de995
fixed a failing test
syed-gilani Oct 22, 2021
ddffbe5
added kwargs to init method of MastMissions class
syed-gilani Oct 22, 2021
213c3a3
made mission and service keyword only arguments
syed-gilani Oct 22, 2021
14587a6
fixed a typo in argument name
syed-gilani Oct 22, 2021
8b9da2b
fixed doc string and added additional assertins in test
syed-gilani Nov 23, 2021
6c65884
added entry to changelog
syed-gilani Feb 2, 2022
cdb0e30
Update missions.py
syed-gilani Feb 1, 2022
2660b2c
updated a docstring
syed-gilani Feb 3, 2022
d122e3d
added a unit test for checking if KeyError is raised
syed-gilani Feb 4, 2022
5e3c5dd
fixed a doc string typo
syed-gilani Feb 4, 2022
5249cd2
added a method to retrieve all searchable columns names and their des…
syed-gilani Feb 7, 2022
6c8c35a
fixed code styling issues
syed-gilani Feb 7, 2022
34e4c16
updated documentation
syed-gilani Feb 9, 2022
cb1710c
removed references to functions that no longer exist
syed-gilani Feb 21, 2022
200af24
Updating mailmap [ci skip]
bsipocz Feb 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added a unit test for checking if KeyError is raised
  • Loading branch information
syed-gilani authored and bsipocz committed Feb 24, 2022
commit d122e3d1e006f258f89a4ea8a6ab0eb756bf8a9c
135 changes: 135 additions & 0 deletions astroquery/mast/tests/data/mission_incorrect_results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"messages": [],
"info": [
{
"name": "sci_release_date",
"type": "DATETIME"
},
{
"name": "sci_actual_duration",
"type": "FLOAT"
},
{
"name": "sci_dec",
"type": "FLOAT"
},
{
"name": "sci_pep_id",
"type": "INTEGER"
},
{
"name": "sci_spec_1234",
"type": "VARCHAR"
},
{
"name": "sci_aper_1234",
"type": "VARCHAR"
},
{
"name": "sci_data_set_name",
"type": "VARCHAR"
},
{
"name": "sci_preview_name",
"type": "VARCHAR"
},
{
"name": "sci_targname",
"type": "VARCHAR"
},
{
"name": "sci_instrume",
"type": "VARCHAR"
},
{
"name": "search_key",
"type": "VARCHAR"
},
{
"name": "sci_central_wavelength",
"type": "FLOAT"
},
{
"name": "sci_status",
"type": "VARCHAR"
},
{
"name": "sci_stop_time",
"type": "DATETIME"
},
{
"name": "scp_scan_type",
"type": "VARCHAR"
},
{
"name": "sci_hlsp",
"type": "INTEGER"
},
{
"name": "sci_refnum",
"type": "INTEGER"
},
{
"name": "sci_start_time",
"type": "DATETIME"
},
{
"name": "sci_ra",
"type": "FLOAT"
}
],
"search_params": {
"target": [
"40.66963 -0.01328"
],
"radius": 3,
"radius_units": "arcminutes",
"offset": 0,
"limit": 5000,
"sort_by": [
"ang_sep",
"sci_targname",
"sci_data_set_name"
],
"sort_desc": [
false,
false,
false
],
"skip_count": false,
"select_cols": [
"sci_data_set_name",
"sci_targname",
"sci_ra",
"sci_dec",
"sci_refnum",
"sci_start_time",
"sci_stop_time",
"sci_actual_duration",
"sci_instrume",
"sci_aper_1234",
"sci_spec_1234",
"sci_central_wavelength",
"sci_pep_id",
"sci_release_date",
"sci_preview_name",
"scp_scan_type",
"sci_hlsp",
"sci_status"
],
"search_key": [],
"user_fields": [],
"conditions": [
{
"sci_obs_type": ""
},
{
"sci_aec": "S"
},
{
"sci_instrume": "STIS,ACS,WFC3,COS,FGS,FOC,FOS,HRS,HSP,NICMOS,WFPC,WFPC2"
}
]
},
"totalResults": 3,
}
32 changes: 32 additions & 0 deletions astroquery/mast/tests/test_mast.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def service_mockreturn(self, method="POST", url=None, data=None, timeout=10, use
filename = data_path(DATA_FILES['z_survey'])
else:
filename = data_path(DATA_FILES['z_cutout_fit'])
elif use_json and data['radius'] == 5:
filename = data_path(DATA_FILES["mission_incorrect_results"])
elif use_json:
filename = data_path(DATA_FILES["mission_search_results"])
content = open(filename, 'rb').read()
Expand Down Expand Up @@ -228,6 +230,36 @@ def test_missions_query_criteria_async(patch_post):
assert isinstance(responses, MockResponse)


def test_missions_query_criteria_async_with_missing_results(patch_post):
pep_id = {'sci_pep_id': '12556'}
obs_type = {'sci_obs_type': "SPECTRUM"}
instruments = {'sci_instrume': "stis,acs,wfc3,cos,fos,foc,nicmos,ghrs"}
datasets = {'sci_data_set_name': ""}
pi_lname = {'sci_pi_last_name': ""}
actual_duration = {'sci_actual_duration': ""}
spec_1234 = {'sci_spec_1234': ""}
release_date = {'sci_release_date': ""}
start_time = {'sci_start_time': ""}
obs_type = {'sci_obs_type': 'all'}
aec = {'sci_aec': 'S'}
aperture = {'sci_aper_1234': 'WF3'}

with pytest.raises(KeyError) as e_info:
responses = mast.MastMissions.query_criteria_async(coordinates=regionCoords,
radius=5,
conditions=[pep_id,
obs_type,
instruments,
datasets,
pi_lname,
spec_1234,
release_date,
start_time,
obs_type,
aec,
aperture])


###################
# MastClass tests #
###################
Expand Down