@@ -41,54 +41,10 @@ def get_mockreturn(method, url, params=None, timeout=10, cache=False, **kwargs):
41
41
return MockResponse (content , ** kwargs )
42
42
43
43
44
- @pytest .mark .parametrize (('dim' ),
45
- ['5d0m0s' , 0.3 * u .rad , '5h0m0s' , 2 * u .arcmin ])
46
- def test_parse_dimension (dim ):
47
- # check that the returned dimension is always in units of 'arcsec',
48
- # 'arcmin' or 'deg'
49
- new_dim = irsa .core ._parse_dimension (dim )
50
- assert new_dim .unit in ['arcsec' , 'arcmin' , 'deg' ]
51
-
52
-
53
- @pytest .mark .parametrize (('ra' , 'dec' , 'expected' ),
54
- [(10 , 10 , '10 +10' ),
55
- (10.0 , - 11 , '10.0 -11' )
56
- ])
57
- def test_format_decimal_coords (ra , dec , expected ):
58
- out = irsa .core ._format_decimal_coords (ra , dec )
59
- assert out == expected
60
-
61
-
62
- @pytest .mark .parametrize (('coordinates' , 'expected' ),
63
- [("5h0m0s 0d0m0s" , "75.0 +0.0" )
64
- ])
65
- def test_parse_coordinates (coordinates , expected ):
66
- out = irsa .core ._parse_coordinates (coordinates )
67
- for a , b in zip (out .split (), expected .split ()):
68
- try :
69
- a = float (a )
70
- b = float (b )
71
- np .testing .assert_almost_equal (a , b )
72
- except ValueError :
73
- assert a == b
74
-
75
-
76
- def test_args_to_payload ():
77
- out = Irsa ._args_to_payload ("fp_psc" )
78
- assert out == dict (catalog = 'fp_psc' , outfmt = 3 , outrows = conf .row_limit ,
79
- selcols = '' )
80
-
81
-
82
- @pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
83
- def test_query_region_cone_async (coordinates , patch_get ):
84
- response = Irsa .query_region_async (
85
- coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
86
- radius = 2 * u .arcmin , get_query_payload = True )
87
- assert response ['radius' ] == 2
88
- assert response ['radunits' ] == 'arcmin'
89
- response = Irsa .query_region_async (
90
- coordinates , catalog = 'fp_psc' , spatial = 'Cone' , radius = 2 * u .arcmin )
91
- assert response is not None
44
+ #def test_args_to_payload():
45
+ # out = Irsa._args_to_payload("fp_psc")
46
+ # assert out == dict(catalog='fp_psc', outfmt=3, outrows=conf.row_limit,
47
+ # selcols='')
92
48
93
49
94
50
@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
@@ -99,18 +55,8 @@ def test_query_region_cone(coordinates, patch_get):
99
55
assert isinstance (result , Table )
100
56
101
57
102
- @pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
103
- def test_query_region_box_async (coordinates , patch_get ):
104
- response = Irsa .query_region_async (
105
- coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
106
- width = 2 * u .arcmin , get_query_payload = True )
107
- assert response ['size' ] == 120
108
- response = Irsa .query_region_async (
109
- coordinates , catalog = 'fp_psc' , spatial = 'Box' , width = 2 * u .arcmin )
110
- assert response is not None
111
-
112
-
113
- @pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
58
+ @pytest .mark .skip ("Upstream TAP doesn't support Box geometry yet" )
59
+ @pytest .mark .parametrize ("coordinates" , OBJ_LIST )
114
60
def test_query_region_box (coordinates , patch_get ):
115
61
result = Irsa .query_region (
116
62
coordinates , catalog = 'fp_psc' , spatial = 'Box' , width = 2 * u .arcmin )
@@ -125,51 +71,17 @@ def test_query_region_box(coordinates, patch_get):
125
71
(10.0 * u .deg , 10.0 * u .deg )]
126
72
127
73
128
- @pytest .mark .parametrize (("polygon" ), [poly1 , poly2 ])
129
- def test_query_region_async_polygon (polygon , patch_get ):
130
- response = Irsa .query_region_async (
131
- "m31" , catalog = "fp_psc" , spatial = "Polygon" ,
132
- polygon = polygon , get_query_payload = True )
133
-
134
- for a , b in zip (re .split ("[ ,]" , response ["polygon" ]),
135
- re .split ("[ ,]" , "10.1 +10.1,10.0 +10.1,10.0 +10.0" )):
136
- for a1 , b1 in zip (a .split (), b .split ()):
137
- a1 = float (a1 )
138
- b1 = float (b1 )
139
- np .testing .assert_almost_equal (a1 , b1 )
140
-
141
- response = Irsa .query_region_async (
142
- "m31" , catalog = "fp_psc" , spatial = "Polygon" , polygon = polygon )
143
-
144
- assert response is not None
145
-
146
-
147
- @pytest .mark .parametrize (("polygon" ),
148
- [poly1 ,
149
- poly2 ,
150
- ])
74
+ @pytest .mark .parametrize ("polygon" , [poly1 , poly2 ])
151
75
def test_query_region_polygon (polygon , patch_get ):
152
- result = Irsa .query_region (
153
- "m31" , catalog = "fp_psc" , spatial = "Polygon" , polygon = polygon )
76
+ result = Irsa .query_region ("m31" , catalog = "fp_psc" , spatial = "Polygon" , polygon = polygon )
154
77
155
78
assert isinstance (result , Table )
156
79
157
80
158
- @pytest .mark .parametrize (('spatial' , 'result' ),
159
- zip (('Cone' , 'Box' , 'Polygon' , 'All-Sky' ),
160
- ('Cone' , 'Box' , 'Polygon' , 'NONE' )))
161
- def test_spatial_valdi (spatial , result ):
162
- out = Irsa ._parse_spatial (
163
- spatial , coordinates = 'm31' , radius = 5 * u .deg , width = 5 * u .deg ,
164
- polygon = [(5 * u .hour , 5 * u .deg )] * 3 )
165
- assert out ['spatial' ] == result
166
-
167
-
168
- @pytest .mark .parametrize (('spatial' ), [('cone' , 'box' , 'polygon' , 'all-Sky' ,
169
- 'All-sky' , 'invalid' , 'blah' )])
81
+ @pytest .mark .parametrize ('spatial' , ['cone' , 'box' , 'polygon' , 'all-Sky' , 'All-sky' , 'invalid' ])
170
82
def test_spatial_invalid (spatial ):
171
83
with pytest .raises (ValueError ):
172
- Irsa ._parse_spatial ( spatial , coordinates = 'm31' )
84
+ Irsa .query_region ( "m31" , catalog = 'invalid_spatial' , spatial = spatial )
173
85
174
86
175
87
def test_deprecated_namespace_import_warning ():
0 commit comments