Skip to content

Commit e7ebba0

Browse files
committed
BadRow->BlankResponse, and parametrize null result tests
1 parent 3bcf834 commit e7ebba0

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

astroquery/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class EmptyResponseError(ValueError):
114114
pass
115115

116116

117-
class BadRowWarning(AstropyWarning):
117+
class BlankResponseWarning(AstropyWarning):
118118
"""
119119
Astroquery warning to be raised if one or more rows in a table are bad, but
120120
not all rows are.

astroquery/simbad/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from astroquery.query import BaseQuery
2121
from astroquery.utils import commons, async_to_sync
22-
from astroquery.exceptions import TableParseError, LargeQueryWarning, BadRowWarning
22+
from astroquery.exceptions import TableParseError, LargeQueryWarning, BlankResponseWarning
2323
from . import conf
2424

2525

@@ -136,7 +136,7 @@ def __warn(self):
136136
"an error (recorded in the `errors` attribute "
137137
"of the result table): %s" %
138138
(error.line, error.msg),
139-
BadRowWarning
139+
BlankResponseWarning
140140
)
141141

142142
def __get_section(self, section_name):

astroquery/simbad/tests/test_simbad_remote.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from astroquery.simbad import Simbad
1111
# Maybe we need to expose SimbadVOTableResult to be in the public API?
1212
from astroquery.simbad.core import SimbadVOTableResult
13-
from astroquery.exceptions import BadRowWarning
13+
from astroquery.exceptions import BlankResponseWarning
1414

1515

1616
# M42 coordinates
@@ -149,7 +149,7 @@ def test_query_multi_object(self, temp_dir):
149149
assert len(result) == 2
150150
assert len(result.errors) == 0
151151

152-
with pytest.warns(BadRowWarning):
152+
with pytest.warns(BlankResponseWarning):
153153
result = simbad.query_objects(['M32', 'M81', 'gHer'])
154154
# 'gHer' is not a valid Simbad identifier - it should be 'g Her' to
155155
# get the star
@@ -183,31 +183,23 @@ def test_query_object_ids(self, temp_dir):
183183
def test_null_response(self, temp_dir, function):
184184
simbad = Simbad()
185185
simbad.cache_location = temp_dir
186-
with pytest.warns(BadRowWarning):
186+
with pytest.warns(BlankResponseWarning):
187187
assert (simbad.__getattribute__(function)('idonotexist')
188188
is None)
189189

190190
# Special case of null test: list of nonexistent parameters
191191
def test_query_objects_null(self, temp_dir):
192192
simbad = Simbad()
193193
simbad.cache_location = temp_dir
194-
with pytest.warns(BadRowWarning):
194+
with pytest.warns(BlankResponseWarning):
195195
assert simbad.query_objects(['idonotexist', 'idonotexisteither']) is None
196196

197-
# Special case of null test: zero-sized region
198-
def test_query_region_null(self, temp_dir):
197+
# Special case of null test: zero-size and very small region
198+
@pytest.mark.parametrize('radius', ["0d", 1.0*u.marcsec])
199+
def test_query_region_null(self, temp_dir, radius):
199200
simbad = Simbad()
200201
simbad.cache_location = temp_dir
201-
with pytest.warns(BadRowWarning):
202-
result = simbad.query_region(SkyCoord("00h01m0.0s 00h00m0.0s"), radius="0d",
203-
equinox=2000.0, epoch='J2000')
204-
assert result is None
205-
206-
# Special case of null test: very small region
207-
def test_query_small_region_null(self, temp_dir):
208-
simbad = Simbad()
209-
simbad.cache_location = temp_dir
210-
with pytest.warns(BadRowWarning):
202+
with pytest.warns(BlankResponseWarning):
211203
result = simbad.query_region(SkyCoord("00h01m0.0s 00h00m0.0s"), radius=1.0 * u.marcsec,
212204
equinox=2000.0, epoch='J2000')
213205
assert result is None

0 commit comments

Comments
 (0)