Skip to content

Commit 8b122a2

Browse files
committed
Changelog, fix test error
1 parent 42c0292 commit 8b122a2

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ mast
183183
- Increased the speed of ``mast.Observations.get_cloud_uris`` by obtaining multiple
184184
URIs from MAST at once. [#3064]
185185

186+
- Present users with an error rather than a warning when nonexistent query criteria are used in ``mast.Observations.query_criteria``
187+
and ``mast.Catalogs.query_criteria``. [#3084]
188+
186189

187190
0.4.7 (2024-03-08)
188191
==================

astroquery/mast/discovery_portal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ def build_filter_set(self, column_config_name, service_name=None, **filters):
407407
# Get the column type and separator
408408
col_info = caom_col_config.get(colname)
409409
if not col_info:
410-
closest_match = difflib.get_close_matches(colname, caom_col_config.keys(), n=1)[0]
411-
error_msg = f"Filter '{colname}' does not exist. Did you mean '{closest_match}'?" if closest_match \
410+
closest_match = difflib.get_close_matches(colname, caom_col_config.keys(), n=1)
411+
error_msg = f"Filter '{colname}' does not exist. Did you mean '{closest_match[0]}'?" if closest_match \
412412
else f"Filter '{colname}' does not exist."
413413
raise InvalidQueryError(error_msg)
414414

astroquery/mast/tests/test_mast_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def test_observations_query_criteria_invalid_keyword(self):
278278
# attempt to make a criteria query with invalid keyword
279279
with pytest.raises(InvalidQueryError) as err_no_alt:
280280
Observations.query_criteria_count(not_a_keyword='TESS')
281-
assert 'Filter not_a_keyword does not exist.' in str(err_no_alt.value)
281+
assert "Filter 'not_a_keyword' does not exist." in str(err_no_alt.value)
282282

283283
# keyword is close enough for difflib to offer alternative
284284
with pytest.raises(InvalidQueryError) as err_with_alt:
@@ -896,7 +896,7 @@ def test_catalogs_query_criteria_invalid_keyword(self):
896896
# attempt to make a criteria query with invalid keyword
897897
with pytest.raises(InvalidQueryError) as err_no_alt:
898898
Catalogs.query_criteria(catalog='tic', not_a_keyword='TESS')
899-
assert 'Filter not_a_keyword does not exist.' in str(err_no_alt.value)
899+
assert "Filter 'not_a_keyword' does not exist." in str(err_no_alt.value)
900900

901901
# keyword is close enough for difflib to offer alternative
902902
with pytest.raises(InvalidQueryError) as err_with_alt:

0 commit comments

Comments
 (0)