Skip to content

Commit b138a77

Browse files
ycopinbsipocz
authored andcommitted
Fixes issue #2756.
1 parent d2373a5 commit b138a77

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

astroquery/skyview/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ def get_image_list(self, position, survey, *, coordinates=None,
254254

255255
if radius is not None:
256256
size_deg = str(radius.to(u.deg).value * 2)
257-
elif width and height:
258-
size_deg = "{0},{1}".format(width.to(u.deg).value,
259-
height.to(u.deg).value)
260-
elif width and height:
257+
elif width is not None and height is not None:
258+
size_deg = "{0},{1}".format(u.Quantity(width).to(u.deg).value,
259+
u.Quantity(height).to(u.deg).value)
260+
elif width is not None or height is not None:
261261
raise ValueError("Must specify width and height if you "
262262
"specify either.")
263263
else:

astroquery/skyview/tests/test_skyview.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,20 @@ def test_survey_validation(patch_get):
8383
assert str(ex.value) == ("Survey is not among the surveys hosted "
8484
"at skyview. See list_surveys or "
8585
"survey_dict for valid surveys.")
86+
87+
88+
def test_get_image_list_size(patch_get, patch_fromname):
89+
# Test with Quantities (as expected)
90+
SkyView.get_image_list(position='Eta Carinae',
91+
survey='DSS',
92+
width=1 * u.deg, height=1 * u.deg)
93+
with pytest.raises(u.UnitConversionError):
94+
# Test with invalid Quantities
95+
SkyView.get_image_list(position='Eta Carinae',
96+
survey='DSS',
97+
width=1, height='1 meter')
98+
with pytest.raises(ValueError):
99+
# Test with incomplete input
100+
SkyView.get_image_list(position='Eta Carinae',
101+
survey='DSS',
102+
width=1 * u.deg, height=None)

0 commit comments

Comments
 (0)