Skip to content

Commit 264309a

Browse files
committed
Fix Path import in core; parametrize test_esasky_get_spectra_obs_id
1 parent 4827362 commit 264309a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

astroquery/esasky/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import re
88
from io import BytesIO
99
from zipfile import ZipFile
10+
from pathlib import Path
1011

1112
from astropy.io import fits
1213
from astroquery import log

astroquery/esasky/tests/test_esasky_remote.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,21 @@ def test_esasky_get_images_obs_id(self, tmp_path, mission, obsid):
8686
else:
8787
assert isinstance(result[mission.upper()][0], HDUList)
8888

89-
def test_esasky_get_spectra_obs_id(self, tmp_path):
90-
missions = ["ISO-IR", "Chandra", "IUE", "XMM-NEWTON", "HST-IR", "Herschel", "HST-UV", "HST-OPTICAL"]
89+
@pytest.mark.parametrize("mission, observation_id",
90+
zip(["ISO-IR", "Chandra", "IUE", "XMM-NEWTON",
91+
"HST-IR", "Herschel", "HST-UV", "HST-OPTICAL"],
92+
["02101201", "1005", "LWR13178", "0001730201",
93+
"ibh706cqq", "1342253595", "z1ax0102t", "oeik2s020"]))
94+
def test_esasky_get_spectra_obs_id(self, tmp_path, mission, observation_id):
95+
result = ESASky.get_spectra(observation_ids=observation_id,
96+
missions=mission, download_dir=tmp_path)
9197

92-
result = ESASky.get_spectra(observation_ids=["02101201", "1005", "LWR13178", "0001730201", "ibh706cqq",
93-
"1342253595", "z1ax0102t", "oeik2s020"],
94-
missions=missions, download_dir=tmp_path)
95-
96-
for mission in missions:
97-
assert (tmp_path / mission).exists()
98-
if mission.upper() == "HERSCHEL":
99-
assert (isinstance(result[mission.upper()]["1342253595"]["WBS"]["WBS-V_USB_4b"], HDUList))
100-
assert (isinstance(result[mission.upper()]["1342253595"]["HRS"]["HRS-H_LSB_4b"], HDUList))
101-
else:
102-
assert (isinstance(result[mission.upper()][0], HDUList))
98+
assert Path(tmp_path, mission).exists()
99+
if mission == "Herschel":
100+
assert isinstance(result[mission.upper()]["1342253595"]["WBS"]["WBS-V_USB_4b"], HDUList)
101+
assert isinstance(result[mission.upper()]["1342253595"]["HRS"]["HRS-H_LSB_4b"], HDUList)
102+
else:
103+
assert isinstance(result[mission.upper()][0], HDUList)
103104

104105
def test_esasky_query_region_maps(self):
105106
result = ESASky.query_region_maps(position="M51", radius="5 arcmin")
@@ -111,7 +112,7 @@ def test_esasky_query_object_maps(self):
111112

112113
@pytest.mark.bigdata
113114
@pytest.mark.parametrize("mission", ['XMM', 'Chandra', 'XMM-OM-OPTICAL',
114-
'ISO-IR','Herschel', 'JWST_Mid-IR',
115+
'ISO-IR', 'Herschel', 'JWST_Mid-IR',
115116
'JWST_Near-IR', 'Spitzer'])
116117
def test_esasky_get_images(self, tmp_path, mission):
117118
ESASky.get_images(position="M51", missions=mission, download_dir=tmp_path)

0 commit comments

Comments
 (0)