Skip to content

Commit 23e7f06

Browse files
committed
catch more nulls
1 parent 39987b4 commit 23e7f06

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

astroquery/simbad/tests/test_simbad_remote.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,29 +183,33 @@ 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-
assert (simbad.__getattribute__(function)('idonotexist')
187-
is None)
186+
with pytest.warns(BadRowWarning):
187+
assert (simbad.__getattribute__(function)('idonotexist')
188+
is None)
188189

189190
# Special case of null test: list of nonexistent parameters
190191
def test_query_objects_null(self, temp_dir):
191192
simbad = Simbad()
192193
simbad.cache_location = temp_dir
193-
assert simbad.query_objects(['idonotexist', 'idonotexisteither']) is None
194+
with pytest.warns(BadRowWarning):
195+
assert simbad.query_objects(['idonotexist', 'idonotexisteither']) is None
194196

195197
# Special case of null test: zero-sized region
196198
def test_query_region_null(self, temp_dir):
197199
simbad = Simbad()
198200
simbad.cache_location = temp_dir
199-
result = simbad.query_region(SkyCoord("00h01m0.0s 00h00m0.0s"), radius="0d",
200-
equinox=2000.0, epoch='J2000')
201+
with pytest.warns(BadRowWarning):
202+
result = simbad.query_region(SkyCoord("00h01m0.0s 00h00m0.0s"), radius="0d",
203+
equinox=2000.0, epoch='J2000')
201204
assert result is None
202205

203206
# Special case of null test: very small region
204207
def test_query_small_region_null(self, temp_dir):
205208
simbad = Simbad()
206209
simbad.cache_location = temp_dir
207-
result = simbad.query_region(SkyCoord("00h01m0.0s 00h00m0.0s"), radius=1.0 * u.marcsec,
208-
equinox=2000.0, epoch='J2000')
210+
with pytest.warns(BadRowWarning):
211+
result = simbad.query_region(SkyCoord("00h01m0.0s 00h00m0.0s"), radius=1.0 * u.marcsec,
212+
equinox=2000.0, epoch='J2000')
209213
assert result is None
210214

211215
# Special case : zero-sized region with one object

0 commit comments

Comments
 (0)