Skip to content

Commit 6fa901c

Browse files
committed
Fix flake8 F codes
1 parent a99e8e8 commit 6fa901c

File tree

5 files changed

+36
-23
lines changed

5 files changed

+36
-23
lines changed

astroquery/alma/tests/test_alma_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
22
import numpy as np
3+
from astropy import units as u
34

45
from .. import utils
56

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os
2+
3+
import pytest
4+
import requests
5+
6+
from astroquery.utils.mocks import MockResponse
7+
8+
9+
SPLAT_DATA = 'CO_colons.csv'
10+
11+
12+
def data_path(filename):
13+
data_dir = os.path.join(os.path.dirname(__file__), 'data')
14+
return os.path.join(data_dir, filename)
15+
16+
17+
@pytest.fixture
18+
def patch_post(request):
19+
mp = request.getfixturevalue("monkeypatch")
20+
21+
mp.setattr(requests.Session, 'request', post_mockreturn)
22+
return mp
23+
24+
25+
def post_mockreturn(self, method, url, data=None, timeout=10, files=None,
26+
params=None, headers=None, **kwargs):
27+
if method != 'POST':
28+
raise ValueError("A 'post request' was made with method != POST")
29+
filename = data_path(SPLAT_DATA)
30+
with open(filename, 'rb') as infile:
31+
content = infile.read()
32+
return MockResponse(content, **kwargs)

astroquery/splatalogue/tests/test_splatalogue.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
import os
44
import pytest
5-
import requests
65

76
from astropy import units as u
87

98
from ... import splatalogue
10-
from astroquery.utils.mocks import MockResponse
9+
1110

1211
SPLAT_DATA = 'CO_colons.csv'
1312

@@ -17,24 +16,6 @@ def data_path(filename):
1716
return os.path.join(data_dir, filename)
1817

1918

20-
@pytest.fixture
21-
def patch_post(request):
22-
mp = request.getfixturevalue("monkeypatch")
23-
24-
mp.setattr(requests.Session, 'request', post_mockreturn)
25-
return mp
26-
27-
28-
def post_mockreturn(self, method, url, data=None, timeout=10, files=None,
29-
params=None, headers=None, **kwargs):
30-
if method != 'POST':
31-
raise ValueError("A 'post request' was made with method != POST")
32-
filename = data_path(SPLAT_DATA)
33-
with open(filename, 'rb') as infile:
34-
content = infile.read()
35-
return MockResponse(content, **kwargs)
36-
37-
3819
def test_simple(patch_post):
3920
splatalogue.Splatalogue.query_lines(114 * u.GHz, 116 * u.GHz,
4021
chemical_name=' CO ')

astroquery/splatalogue/tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2-
from ... import splatalogue
32
from astropy import units as u
43
import numpy as np
54
import pytest
6-
from .test_splatalogue import patch_post
5+
6+
from ... import splatalogue
77
from .. import utils
88

99

astroquery/svo_fps/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy as np
21
import requests
32
import io
43

0 commit comments

Comments
 (0)