10
10
from astroquery .simbad import Simbad
11
11
# Maybe we need to expose SimbadVOTableResult to be in the public API?
12
12
from astroquery .simbad .core import SimbadVOTableResult
13
+ from astroquery .exceptions import BlankResponseWarning
13
14
14
15
15
16
# M42 coordinates
16
- ICRS_COORDS_M42 = SkyCoord ("05h35m17.3s -05h23m28s " , frame = 'icrs' )
17
+ ICRS_COORDS_M42 = SkyCoord ("05h35m17.3s -05d23m28s " , frame = 'icrs' )
17
18
ICRS_COORDS_SgrB2 = SkyCoord (266.835 * u .deg , - 28.38528 * u .deg , frame = 'icrs' )
18
19
multicoords = SkyCoord ([ICRS_COORDS_M42 , ICRS_COORDS_SgrB2 ])
19
20
@@ -99,8 +100,7 @@ def test_query_catalog(self, temp_dir):
99
100
100
101
def test_query_region_async (self , temp_dir ):
101
102
simbad = Simbad ()
102
- # TODO: rewise once ROW_LIMIT is working
103
- simbad .TIMEOUT = 100
103
+ simbad .ROW_LIMIT = 100
104
104
simbad .cache_location = temp_dir
105
105
response = simbad .query_region_async (
106
106
ICRS_COORDS_M42 , radius = 2 * u .deg , equinox = 2000.0 , epoch = 'J2000' )
@@ -112,12 +112,12 @@ def test_query_region_async_vector(self, temp_dir, radius):
112
112
simbad = Simbad ()
113
113
simbad .cache_location = temp_dir
114
114
response1 = simbad .query_region_async (multicoords , radius = radius )
115
- assert response1 .request .body == 'script=votable+%7Bmain_id%2Ccoordinates%7D%0Avotable+open%0Aquery+coo+5%3A35%3A17.3+-80%3A52%3A00 +radius%3D0.5s+frame%3DICRS+equi%3D2000.0%0Aquery+coo+17%3A47%3A20.4+-28%3A23%3A07.008+radius%3D0.5s+frame%3DICRS+equi%3D2000.0%0Avotable+close' # noqa
115
+ assert response1 .request .body == 'script=votable+%7Bmain_id%2Ccoordinates%7D%0Avotable+open%0Aquery+coo+5%3A35%3A17.3+-5%3A23%3A28 +radius%3D0.5s+frame%3DICRS+equi%3D2000.0%0Aquery+coo+17%3A47%3A20.4+-28%3A23%3A07.008+radius%3D0.5s+frame%3DICRS+equi%3D2000.0%0Avotable+close' # noqa
116
116
117
117
def test_query_region (self , temp_dir ):
118
118
simbad = Simbad ()
119
- # TODO: rewise once ROW_LIMIT is working
120
119
simbad .TIMEOUT = 100
120
+ simbad .ROW_LIMIT = 100
121
121
simbad .cache_location = temp_dir
122
122
result = simbad .query_region (ICRS_COORDS_M42 , radius = 2 * u .deg ,
123
123
equinox = 2000.0 , epoch = 'J2000' )
@@ -149,7 +149,8 @@ def test_query_multi_object(self, temp_dir):
149
149
assert len (result ) == 2
150
150
assert len (result .errors ) == 0
151
151
152
- result = simbad .query_objects (['M32' , 'M81' , 'gHer' ])
152
+ with pytest .warns (BlankResponseWarning ):
153
+ result = simbad .query_objects (['M32' , 'M81' , 'gHer' ])
153
154
# 'gHer' is not a valid Simbad identifier - it should be 'g Her' to
154
155
# get the star
155
156
assert len (result ) == 2
@@ -182,29 +183,25 @@ def test_query_object_ids(self, temp_dir):
182
183
def test_null_response (self , temp_dir , function ):
183
184
simbad = Simbad ()
184
185
simbad .cache_location = temp_dir
185
- assert (simbad .__getattribute__ (function )('idonotexist' )
186
- is None )
186
+ with pytest .warns (BlankResponseWarning ):
187
+ assert (simbad .__getattribute__ (function )('idonotexist' )
188
+ is None )
187
189
188
190
# Special case of null test: list of nonexistent parameters
189
191
def test_query_objects_null (self , temp_dir ):
190
192
simbad = Simbad ()
191
193
simbad .cache_location = temp_dir
192
- assert simbad .query_objects (['idonotexist' , 'idonotexisteither' ]) is None
194
+ with pytest .warns (BlankResponseWarning ):
195
+ assert simbad .query_objects (['idonotexist' , 'idonotexisteither' ]) is None
193
196
194
- # Special case of null test: zero-sized region
195
- 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 ):
196
200
simbad = Simbad ()
197
201
simbad .cache_location = temp_dir
198
- result = simbad .query_region (SkyCoord ("00h01m0.0s 00h00m0.0s" ), radius = "0d" ,
199
- equinox = 2000.0 , epoch = 'J2000' )
200
- assert result is None
201
-
202
- # Special case of null test: very small region
203
- def test_query_small_region_null (self , temp_dir ):
204
- simbad = Simbad ()
205
- simbad .cache_location = temp_dir
206
- result = simbad .query_region (SkyCoord ("00h01m0.0s 00h00m0.0s" ), radius = 1.0 * u .marcsec ,
207
- equinox = 2000.0 , epoch = 'J2000' )
202
+ with pytest .warns (BlankResponseWarning ):
203
+ result = simbad .query_region (SkyCoord ("00h01m0.0s 00h00m0.0s" ), radius = 1.0 * u .marcsec ,
204
+ equinox = 2000.0 , epoch = 'J2000' )
208
205
assert result is None
209
206
210
207
# Special case : zero-sized region with one object
0 commit comments