10
10
import astropy .coordinates as coord
11
11
import astropy .units as u
12
12
13
- from .. .utils .testing_tools import MockResponse
14
- from .. .utils import commons
15
- from ... import irsa
16
- from ... irsa import conf
13
+ from astroquery .utils .testing_tools import MockResponse
14
+ from astroquery .utils import commons
15
+ from astroquery . irsa import Irsa , conf
16
+ from astroquery import irsa
17
17
18
18
DATA_FILES = {'Cone' : 'Cone.xml' ,
19
19
'Box' : 'Box.xml' ,
@@ -35,7 +35,7 @@ def patch_get(request):
35
35
mp = request .getfixturevalue ("monkeypatch" )
36
36
except AttributeError : # pytest < 3
37
37
mp = request .getfuncargvalue ("monkeypatch" )
38
- mp .setattr (irsa . Irsa , '_request' , get_mockreturn )
38
+ mp .setattr (Irsa , '_request' , get_mockreturn )
39
39
return mp
40
40
41
41
@@ -78,45 +78,45 @@ def test_parse_coordinates(coordinates, expected):
78
78
79
79
80
80
def test_args_to_payload ():
81
- out = irsa . core . Irsa ._args_to_payload ("fp_psc" )
81
+ out = Irsa ._args_to_payload ("fp_psc" )
82
82
assert out == dict (catalog = 'fp_psc' , outfmt = 3 , outrows = conf .row_limit ,
83
83
selcols = '' )
84
84
85
85
86
86
@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
87
87
def test_query_region_cone_async (coordinates , patch_get ):
88
- response = irsa . core . Irsa .query_region_async (
88
+ response = Irsa .query_region_async (
89
89
coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
90
90
radius = 2 * u .arcmin , get_query_payload = True )
91
91
assert response ['radius' ] == 2
92
92
assert response ['radunits' ] == 'arcmin'
93
- response = irsa . core . Irsa .query_region_async (
93
+ response = Irsa .query_region_async (
94
94
coordinates , catalog = 'fp_psc' , spatial = 'Cone' , radius = 2 * u .arcmin )
95
95
assert response is not None
96
96
97
97
98
98
@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
99
99
def test_query_region_cone (coordinates , patch_get ):
100
- result = irsa . core . Irsa .query_region (
100
+ result = Irsa .query_region (
101
101
coordinates , catalog = 'fp_psc' , spatial = 'Cone' , radius = 2 * u .arcmin )
102
102
103
103
assert isinstance (result , Table )
104
104
105
105
106
106
@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
107
107
def test_query_region_box_async (coordinates , patch_get ):
108
- response = irsa . core . Irsa .query_region_async (
108
+ response = Irsa .query_region_async (
109
109
coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
110
110
width = 2 * u .arcmin , get_query_payload = True )
111
111
assert response ['size' ] == 120
112
- response = irsa . core . Irsa .query_region_async (
112
+ response = Irsa .query_region_async (
113
113
coordinates , catalog = 'fp_psc' , spatial = 'Box' , width = 2 * u .arcmin )
114
114
assert response is not None
115
115
116
116
117
117
@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
118
118
def test_query_region_box (coordinates , patch_get ):
119
- result = irsa . core . Irsa .query_region (
119
+ result = Irsa .query_region (
120
120
coordinates , catalog = 'fp_psc' , spatial = 'Box' , width = 2 * u .arcmin )
121
121
122
122
assert isinstance (result , Table )
@@ -129,12 +129,9 @@ def test_query_region_box(coordinates, patch_get):
129
129
(10.0 * u .deg , 10.0 * u .deg )]
130
130
131
131
132
- @pytest .mark .parametrize (("polygon" ),
133
- [poly1 ,
134
- poly2
135
- ])
132
+ @pytest .mark .parametrize (("polygon" ), [poly1 , poly2 ])
136
133
def test_query_region_async_polygon (polygon , patch_get ):
137
- response = irsa . core . Irsa .query_region_async (
134
+ response = Irsa .query_region_async (
138
135
"m31" , catalog = "fp_psc" , spatial = "Polygon" ,
139
136
polygon = polygon , get_query_payload = True )
140
137
@@ -145,7 +142,7 @@ def test_query_region_async_polygon(polygon, patch_get):
145
142
b1 = float (b1 )
146
143
np .testing .assert_almost_equal (a1 , b1 )
147
144
148
- response = irsa . core . Irsa .query_region_async (
145
+ response = Irsa .query_region_async (
149
146
"m31" , catalog = "fp_psc" , spatial = "Polygon" , polygon = polygon )
150
147
151
148
assert response is not None
@@ -156,7 +153,7 @@ def test_query_region_async_polygon(polygon, patch_get):
156
153
poly2 ,
157
154
])
158
155
def test_query_region_polygon (polygon , patch_get ):
159
- result = irsa . core . Irsa .query_region (
156
+ result = Irsa .query_region (
160
157
"m31" , catalog = "fp_psc" , spatial = "Polygon" , polygon = polygon )
161
158
162
159
assert isinstance (result , Table )
@@ -166,7 +163,7 @@ def test_query_region_polygon(polygon, patch_get):
166
163
zip (('Cone' , 'Box' , 'Polygon' , 'All-Sky' ),
167
164
('Cone' , 'Box' , 'Polygon' , 'NONE' )))
168
165
def test_spatial_valdi (spatial , result ):
169
- out = irsa . core . Irsa ._parse_spatial (
166
+ out = Irsa ._parse_spatial (
170
167
spatial , coordinates = 'm31' , radius = 5 * u .deg , width = 5 * u .deg ,
171
168
polygon = [(5 * u .hour , 5 * u .deg )] * 3 )
172
169
assert out ['spatial' ] == result
@@ -176,4 +173,4 @@ def test_spatial_valdi(spatial, result):
176
173
'All-sky' , 'invalid' , 'blah' )])
177
174
def test_spatial_invalid (spatial ):
178
175
with pytest .raises (ValueError ):
179
- irsa . core . Irsa ._parse_spatial (spatial , coordinates = 'm31' )
176
+ Irsa ._parse_spatial (spatial , coordinates = 'm31' )
0 commit comments