2
2
3
3
import pytest
4
4
import os
5
- import warnings
6
5
7
6
from astroquery .utils .testing_tools import MockResponse
8
7
import astropy .units as u
@@ -61,11 +60,10 @@ def test_input():
61
60
2451200 , get_query_payload = True )
62
61
assert (a ['-rd' ] == b ['-rd' ])
63
62
64
- with warnings . catch_warnings ( record = True ) as w :
63
+ with pytest . warns ( UserWarning , match = 'search cone radius' ) :
65
64
a = core .Skybot .cone_search ((100 , 20 ), 100 , 2451200 ,
66
65
get_query_payload = True )
67
66
assert (a ['-rd' ] == 10 )
68
- assert ('search cone radius' in str (w [- 1 ].message ))
69
67
70
68
# test epoch input
71
69
a = core .Skybot .cone_search ((100 , 20 ), 1 , 2451200 , get_query_payload = True )
@@ -84,11 +82,10 @@ def test_input():
84
82
get_query_payload = True )
85
83
assert (a ['-filter' ] == b ['-filter' ])
86
84
87
- with warnings . catch_warnings ( record = True ) as w :
85
+ with pytest . warns ( UserWarning , match = 'positional error' ) :
88
86
a = core .Skybot .cone_search ((100 , 20 ), 1 , 2451200 , position_error = 1000 ,
89
87
get_query_payload = True )
90
88
assert (a ['-filter' ] == 120 )
91
- assert ('positional error' in str (w [- 1 ].message ))
92
89
93
90
# test target filters
94
91
a = core .Skybot .cone_search ((100 , 20 ), 1 , 2451200 , get_query_payload = True )
0 commit comments