Skip to content

Commit 0c96a7e

Browse files
committed
Fix bug in get_cloud_uris; add test
1 parent e666051 commit 0c96a7e

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

astroquery/mast/observations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def get_cloud_uris(self, data_products, *, include_bucket=True, full_url=False):
769769
'See MAST Labs documentation for an example: https://mast-labs.stsci.io/#example-data-access-with-astroquery-observations')
770770

771771
# Remove duplicate products
772-
products = self._remove_duplicate_products(products)
772+
data_products = self._remove_duplicate_products(data_products)
773773

774774
return self._cloud_connection.get_cloud_uri_list(data_products, include_bucket, full_url)
775775

astroquery/mast/tests/test_mast_remote.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_observations_download_products(self, tmpdir):
275275
assert os.path.isfile(row['Local Path'])
276276

277277
# just get the curl script
278-
result = mast.Observations.download_products(test_obs[0]["obsid"],
278+
result = mast.Observations.download_products(test_obs_id[0]["obsid"],
279279
download_dir=str(tmpdir),
280280
curl_flag=True,
281281
productType=["SCIENCE"],
@@ -284,16 +284,16 @@ def test_observations_download_products(self, tmpdir):
284284
assert os.path.isfile(result['Local Path'][0])
285285

286286
# check for row input
287-
result1 = mast.Observations.get_product_list(test_obs[0]["obsid"])
287+
result1 = mast.Observations.get_product_list(test_obs_id[0]["obsid"])
288288
result2 = mast.Observations.download_products(result1[0])
289289
assert isinstance(result2, Table)
290290
assert os.path.isfile(result2['Local Path'][0])
291291
assert len(result2) == 1
292292

293-
def test_observations_download_products_noduplicates(self, tmpdir):
293+
def test_observations_download_products_no_duplicates(tmpdir):
294294

295-
# Pull products for a NIRSpec MSA observation with 6 known duplicates
296-
# of the MSA configuration file
295+
# Pull products for a JWST NIRSpec MSA observation with 6 known
296+
# duplicates of the MSA configuration file, propID=2736
297297
products = mast.Observations.get_product_list("87602009")
298298

299299
# Filter out everything but the MSA config file
@@ -310,6 +310,15 @@ def test_observations_download_products_noduplicates(self, tmpdir):
310310
# Check that it downloads the MSA config file only once
311311
assert len(manifest) == 1
312312

313+
# enable access to public AWS S3 bucket
314+
mast.Observations.enable_cloud_dataset()
315+
316+
# Check duplicate cloud URIs as well
317+
with pytest.warns(DuplicateResultsWarning):
318+
uris = mast.Observations.get_cloud_uris(products)
319+
320+
assert len(uris) == 1
321+
313322
def test_observations_download_file(self, tmpdir):
314323

315324
# enabling cloud connection

0 commit comments

Comments
 (0)