1212
1313from ...utils .testing_tools import MockResponse
1414from ...utils import commons
15- from ... import irsa
16- from ...irsa import conf
15+ from ... import lcogt
16+ from ...lcogt import conf
1717
1818DATA_FILES = {'Cone' : 'Cone.xml' ,
1919 'Box' : 'Box.xml' ,
@@ -44,7 +44,7 @@ def get_mockreturn(url, params=None, timeout=10, **kwargs):
4444@pytest .mark .parametrize (('dim' ), ['5d0m0s' , 0.3 * u .rad , '5h0m0s' , 2 * u .arcmin ])
4545def test_parse_dimension (dim ):
4646 # check that the returned dimension is always in units of 'arcsec', 'arcmin' or 'deg'
47- new_dim = irsa .core ._parse_dimension (dim )
47+ new_dim = lcogt .core ._parse_dimension (dim )
4848 assert new_dim .unit in ['arcsec' , 'arcmin' , 'deg' ]
4949
5050
@@ -53,15 +53,15 @@ def test_parse_dimension(dim):
5353 (10.0 , - 11 , '10.0 -11' )
5454 ])
5555def test_format_decimal_coords (ra , dec , expected ):
56- out = irsa .core ._format_decimal_coords (ra , dec )
56+ out = lcogt .core ._format_decimal_coords (ra , dec )
5757 assert out == expected
5858
5959
6060@pytest .mark .parametrize (('coordinates' , 'expected' ),
6161 [("5h0m0s 0d0m0s" , "75.0 +0.0" )
6262 ])
6363def test_parse_coordinates (coordinates , expected ):
64- out = irsa .core ._parse_coordinates (coordinates )
64+ out = lcogt .core ._parse_coordinates (coordinates )
6565 for a , b in zip (out .split (), expected .split ()):
6666 try :
6767 a = float (a )
@@ -72,41 +72,41 @@ def test_parse_coordinates(coordinates, expected):
7272
7373
7474def test_args_to_payload ():
75- out = irsa .core .Irsa ._args_to_payload ("fp_psc" )
75+ out = lcogt .core .Lcogt ._args_to_payload ("fp_psc" )
7676 assert out == dict (catalog = 'fp_psc' , outfmt = 3 , outrows = conf .row_limit )
7777
7878
7979@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
8080def test_query_region_cone_async (coordinates , patch_get ):
81- response = irsa .core .Irsa .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
81+ response = lcogt .core .Lcogt .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
8282 radius = 2 * u .arcmin , get_query_payload = True )
8383 assert response ['radius' ] == 2
8484 assert response ['radunits' ] == 'arcmin'
85- response = irsa .core .Irsa .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
85+ response = lcogt .core .Lcogt .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
8686 radius = 2 * u .arcmin )
8787 assert response is not None
8888
8989
9090@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
9191def test_query_region_cone (coordinates , patch_get ):
92- result = irsa .core .Irsa .query_region (coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
92+ result = lcogt .core .Lcogt .query_region (coordinates , catalog = 'fp_psc' , spatial = 'Cone' ,
9393 radius = 2 * u .arcmin )
9494 assert isinstance (result , Table )
9595
9696
9797@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
9898def test_query_region_box_async (coordinates , patch_get ):
99- response = irsa .core .Irsa .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
99+ response = lcogt .core .Lcogt .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
100100 width = 2 * u .arcmin , get_query_payload = True )
101101 assert response ['size' ] == 120
102- response = irsa .core .Irsa .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
102+ response = lcogt .core .Lcogt .query_region_async (coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
103103 width = 2 * u .arcmin )
104104 assert response is not None
105105
106106
107107@pytest .mark .parametrize (("coordinates" ), OBJ_LIST )
108108def test_query_region_box (coordinates , patch_get ):
109- result = irsa .core .Irsa .query_region (coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
109+ result = lcogt .core .Lcogt .query_region (coordinates , catalog = 'fp_psc' , spatial = 'Box' ,
110110 width = 2 * u .arcmin )
111111 assert isinstance (result , Table )
112112
@@ -121,7 +121,7 @@ def test_query_region_box(coordinates, patch_get):
121121 poly2
122122 ])
123123def test_query_region_async_polygon (polygon , patch_get ):
124- response = irsa .core .Irsa .query_region_async ("m31" , catalog = "fp_psc" , spatial = "Polygon" ,
124+ response = lcogt .core .Lcogt .query_region_async ("m31" , catalog = "fp_psc" , spatial = "Polygon" ,
125125 polygon = polygon , get_query_payload = True )
126126
127127 for a , b in zip (re .split ("[ ,]" , response ["polygon" ]),
@@ -131,7 +131,7 @@ def test_query_region_async_polygon(polygon, patch_get):
131131 b1 = float (b1 )
132132 np .testing .assert_almost_equal (a1 , b1 )
133133
134- response = irsa .core .Irsa .query_region_async ("m31" , catalog = "fp_psc" , spatial = "Polygon" ,
134+ response = lcogt .core .Lcogt .query_region_async ("m31" , catalog = "fp_psc" , spatial = "Polygon" ,
135135 polygon = polygon )
136136 assert response is not None
137137
@@ -141,19 +141,19 @@ def test_query_region_async_polygon(polygon, patch_get):
141141 poly2 ,
142142 ])
143143def test_query_region_polygon (polygon , patch_get ):
144- result = irsa .core .Irsa .query_region ("m31" , catalog = "fp_psc" , spatial = "Polygon" ,
144+ result = lcogt .core .Lcogt .query_region ("m31" , catalog = "fp_psc" , spatial = "Polygon" ,
145145 polygon = polygon )
146146 assert isinstance (result , Table )
147147
148148
149149@pytest .mark .parametrize (('spatial' , 'result' ), zip (('Cone' , 'Box' , 'Polygon' , 'All-Sky' ), ('Cone' , 'Box' , 'Polygon' , 'NONE' )))
150150def test_spatial_valdi (spatial , result ):
151- out = irsa .core .Irsa ._parse_spatial (spatial , coordinates = 'm31' , radius = 5 * u .deg , width = 5 * u .deg , polygon = [(5 * u .hour , 5 * u .deg )] * 3 )
151+ out = lcogt .core .Lcogt ._parse_spatial (spatial , coordinates = 'm31' , radius = 5 * u .deg , width = 5 * u .deg , polygon = [(5 * u .hour , 5 * u .deg )] * 3 )
152152 assert out ['spatial' ] == result
153153
154154
155155@pytest .mark .parametrize (('spatial' ), [('cone' , 'box' , 'polygon' , 'all-Sky' , 'All-sky' , 'invalid' , 'blah' )])
156156def test_spatial_invalid (spatial ):
157157 with pytest .raises (ValueError ):
158- irsa .core .Irsa ._parse_spatial (spatial , coordinates = 'm31' )
158+ lcogt .core .Lcogt ._parse_spatial (spatial , coordinates = 'm31' )
159159
0 commit comments