Skip to content

Commit d63557c

Browse files
committed
increasing coverage
1 parent c3394c3 commit d63557c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

astroquery/sdss/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def query_crossid_async(self, coordinates, *, radius=5. * u.arcsec, timeout=TIME
140140
The result of the query as a `~astropy.table.Table` object.
141141
142142
"""
143+
143144
if isinstance(radius, Angle):
144145
radius = radius.to_value(u.arcmin)
145146
else:

astroquery/sdss/tests/test_sdss.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,31 @@ def test_list_coordinates(patch_request, dr, radius, width):
298298
url_tester(dr)
299299

300300

301+
@pytest.mark.parametrize("width", [Angle('2 arcsec'), 2.0 * u.arcsec, '2.0 arcsec', 'bad angle'])
302+
@pytest.mark.parametrize("height", [None, Angle('2 arcsec'), 2.0 * u.arcsec, '2.0 arcsec', 'bad angle'])
303+
def test_list_coordinates_with_height(patch_request, width, height):
304+
if width == 'bad angle' or height == 'bad angle':
305+
with pytest.raises(TypeError) as e:
306+
sdss.SDSS.query_region(coords, width=width, height=height)
307+
if width == 'bad angle':
308+
assert str(e.value) == "width should be either Quantity or convertible to float."
309+
else:
310+
assert str(e.value) == "height should be either Quantity or convertible to float."
311+
else:
312+
xid = sdss.SDSS.query_region(coords_list, width=width, height=height)
313+
314+
with warnings.catch_warnings():
315+
if sys.platform.startswith('win'):
316+
warnings.filterwarnings("ignore", category=AstropyWarning,
317+
message=r'OverflowError converting.*')
318+
data = Table.read(data_path(DATA_FILES['images_id']),
319+
format='ascii.csv', comment='#')
320+
321+
data['objid'] = data['objid'].astype(np.int64)
322+
323+
compare_xid_data(xid, data)
324+
325+
301326
@pytest.mark.parametrize("dr", dr_list)
302327
def test_column_coordinates(patch_request, dr):
303328
xid = sdss.SDSS.query_region(coords_column, radius=Angle('2 arcsec'), data_release=dr)

0 commit comments

Comments
 (0)