Skip to content

Commit e0baf0d

Browse files
authored
Merge pull request #3260 from snbianco/mm-case-sensitive
Make criteria in MastMissions queries case-sensitive
2 parents fb9fef1 + 3658f6e commit e0baf0d

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ mast
7373

7474
- Bugfix where ``Observations.get_cloud_uri`` and ``Observations.get_cloud_uris`` fail if the MAST relative path is not found. [#3193]
7575

76+
- Corrected parameter checking in ``MastMissions`` to ensure case-sensitive comparisons. [#3260]
77+
7678
simbad
7779
^^^^^^
7880

astroquery/mast/missions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def _validate_criteria(self, **criteria):
132132
# Check each criteria argument for validity
133133
valid_cols = list(self.columns[self.mission]['name']) + self._search_option_fields
134134
for kwd in criteria.keys():
135-
col = next((name for name in valid_cols if name.lower() == kwd.lower()), None)
135+
col = next((name for name in valid_cols if name == kwd), None)
136136
if not col:
137137
closest_match = difflib.get_close_matches(kwd, valid_cols, n=1)
138138
error_msg = (
@@ -499,7 +499,7 @@ def download_file(self, uri, *, local_path=None, cache=True, verbose=True):
499499

500500
try:
501501
# Attempt file download
502-
self._download_file(escaped_url, local_path, cache=cache, continuation=False, verbose=verbose)
502+
self._download_file(escaped_url, local_path, cache=cache, verbose=verbose)
503503

504504
# Check if file exists
505505
if not local_path.is_file() and status != 'SKIPPED':

astroquery/mast/tests/test_mast_remote.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ def test_missions_query_criteria_invalid_keyword(self):
154154
MastMissions.query_criteria(search_position='30 30')
155155
assert 'search_pos' in str(err_with_alt.value)
156156

157+
# Should be case sensitive
158+
with pytest.raises(InvalidQueryError) as err_case:
159+
MastMissions.query_criteria(Search_Pos='30 30')
160+
assert 'search_pos' in str(err_case.value)
161+
157162
def test_missions_get_product_list_async(self):
158163
datasets = MastMissions.query_object("M4", radius=0.1)
159164

@@ -315,7 +320,7 @@ def check_result(result, path):
315320

316321
@pytest.mark.parametrize("mission, query_params", [
317322
('jwst', {'fileSetName': 'jw01189001001_02101_00001'}),
318-
('classy', {'target': 'J0021+0052'}),
323+
('classy', {'Target': 'J0021+0052'}),
319324
('ullyses', {'host_galaxy_name': 'WLM', 'select_cols': ['observation_id']})
320325
])
321326
def test_missions_workflow(self, tmp_path, mission, query_params):

0 commit comments

Comments
 (0)