Skip to content

Commit aeeb4dc

Browse files
NXSA-1091: Added missing lines of code
1 parent bd1643d commit aeeb4dc

File tree

3 files changed

+2
-36
lines changed

3 files changed

+2
-36
lines changed

astroquery/esa/xmm_newton/core.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import configparser
2525

2626
from astropy.io import fits
27-
from . import conf, config
27+
from . import conf
2828
from astroquery import log
2929
from astropy.coordinates import SkyCoord
3030
from ...exceptions import LoginError
@@ -114,11 +114,7 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
114114
# If the user wants to access proprietary data, ask them for there credentials
115115
if prop:
116116
username, password = self._get_username_and_password(credentials_file)
117-
<<<<<<< HEAD
118117
link = f"{link}&AIOUSER={username}&AIOPWD={password}"
119-
=======
120-
link = link + "&AIOUSER=" + username + "&AIOPWD=" + password
121-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
122118

123119
if verbose:
124120
log.info(link)
@@ -135,11 +131,7 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
135131
self._download_file(link, filename, head_safe=True, cache=cache)
136132

137133
if verbose:
138-
<<<<<<< HEAD
139134
log.info(f"Wrote {link} to {filename}")
140-
=======
141-
log.info("Wrote {0} to {1}".format(link, filename))
142-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
143135
log.setLevel(previouslevel)
144136

145137
def get_postcard(self, observation_id, *, image_type="OBS_EPIC",
@@ -286,11 +278,7 @@ def get_columns(self, table_name, *, only_names=True, verbose=False):
286278
return columns
287279

288280
def _create_link(self, observation_id, **kwargs):
289-
<<<<<<< HEAD
290281
link = f"{self.data_aio_url}obsno={observation_id}"
291-
=======
292-
link = self.data_aio_url + "obsno=" + observation_id
293-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
294282
link = link + "".join("&{0}={1}".format(key, val)
295283
for key, val in kwargs.items())
296284
return link

astroquery/esa/xmm_newton/tests/test_xmm_newton.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
22
"""
3-
43
@author: Elena Colomo
54
6-
75
European Space Astronomy Centre (ESAC)
86
European Space Agency (ESA)
9-
107
Created on 4 Sept. 2019
118
"""
12-
<<<<<<< HEAD
139
from unittest.mock import patch
14-
=======
15-
from unittest.mock import patch, MagicMock
16-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
1710

1811
import pytest
1912
import tarfile
@@ -27,11 +20,7 @@
2720
from astroquery.exceptions import LoginError
2821

2922

30-
<<<<<<< HEAD
3123
class mockResponse():
32-
=======
33-
class mockResponse:
34-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
3524
headers = {'Date': 'Wed, 24 Nov 2021 13:43:50 GMT',
3625
'Server': 'Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips',
3726
'Content-Disposition': 'inline; filename="0560181401.tar.gz"',
@@ -42,13 +31,8 @@ class mockResponse:
4231
@staticmethod
4332
def raise_for_status():
4433
pass
45-
<<<<<<< HEAD
46-
47-
48-
=======
4934

5035

51-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
5236
class TestXMMNewton():
5337
def get_dummy_tap_handler(self):
5438
parameters = {'query': "select top 10 * from v_public_observations",
@@ -543,7 +527,6 @@ def test_request_link(self, mock_request):
543527
params = xsa._request_link("https://nxsa.esac.esa.int/nxsa-sl/servlet/data-action-aio?obsno=0560181401", None)
544528
assert params == {'filename': '0560181401.tar.gz'}
545529

546-
<<<<<<< HEAD
547530
@pytest.mark.xfail(raises=LoginError)
548531
@patch('astroquery.query.BaseQuery._request')
549532
def test_request_link_protected(self, mock_request):
@@ -563,8 +546,6 @@ def test_request_link_incorrect_credentials(self, mock_request):
563546
mock_request.return_value = dummyclass
564547
xsa._request_link("https://nxsa.esac.esa.int/nxsa-sl/servlet/data-action-aio?obsno=0560181401", None)
565548

566-
=======
567-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
568549
def test_get_username_and_password(self):
569550
xsa = XMMNewtonClass(self.get_dummy_tap_handler())
570551
username, password = xsa._get_username_and_password("astroquery/esa/xmm_newton/tests/my_config.ini")
@@ -579,4 +560,4 @@ def test_create_filename_None(self):
579560
def test_create_filename_Not_None(self):
580561
xsa = XMMNewtonClass(self.get_dummy_tap_handler())
581562
filename = xsa._create_filename("Test", "0560181401", ['.tar', '.gz'])
582-
assert filename == "Test.tar.gz"
563+
assert filename == "Test.tar.gz"

astroquery/esa/xmm_newton/tests/test_xmm_newton_remote.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def test_download_proprietary_data_incorrect_credentials(self):
199199
parameters = {'observation_id': "0762470101",
200200
'prop': 'True',
201201
'credentials_file': "astroquery/esa/xmm_newton/tests/my_config.ini",
202-
<<<<<<< HEAD
203202
'level': "PPS",
204203
'name': 'OBSMLI',
205204
'filename': 'single',
@@ -213,8 +212,6 @@ def test_download_proprietary_data_incorrect_credentials(self):
213212
@pytest.mark.xfail(raises=LoginError)
214213
def test_download_proprietary_data_without_credentials(self):
215214
parameters = {'observation_id': "0883780101",
216-
=======
217-
>>>>>>> 40576ad4 (xmm_newton-1.1_issue1093 Refactored the download data method and added the corresponding tests)
218215
'level': "PPS",
219216
'name': 'OBSMLI',
220217
'filename': 'single',

0 commit comments

Comments
 (0)