Skip to content

Commit

Permalink
remove some comments, still not done with the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Feb 28, 2019
1 parent 18eee30 commit c7f5c18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
5 changes: 1 addition & 4 deletions astroquery/higal/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,14 @@ def query_region_async(self, coordinates, radius,

return response

# as we mentioned earlier use various python regular expressions, etc
# to create the dict of HTTP request parameters by parsing the user
# entered values. For cleaner code keep this as a separate private method:

def _args_to_payload(self, coords=None, name=None, radius=10*u.arcmin,
catalog_id=None, catalog_query=True, *args, **kwargs):

if not hasattr(self, '_session_id'):
# set up session: get cookies
initial_response = self._request('GET', self.URL, cache=False,
timeout=self.TIMEOUT)
initial_response.raise_for_status()

# multiple cookies are returned
self._session_id = self._session.cookies.values()[1]
Expand Down
23 changes: 4 additions & 19 deletions astroquery/higal/tests/test_higal.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function

# astroquery uses the pytest framework for testing
# this is already available in astropy and does
# not require a separate install. Import it using:
import pytest

# It would be best if tests are separated in two
# modules. This module performs tests on local data
# by mocking HTTP requests and responses. To test the
# same functions on the remote server, put the relevant
# tests in the 'test_module_remote.py'

# Now import other commonly used modules for tests
import os
import requests

Expand All @@ -23,10 +13,8 @@

from ...utils.testing_tools import MockResponse

# finally import the module which is to be tested
# and the various configuration items created
from ... import template_module
from ...template_module import conf
from ... import higal
from ...higal import conf

# Local tests should have the corresponding data stored
# in the ./data folder. This is the actual HTTP response
Expand Down Expand Up @@ -71,15 +59,12 @@ def patch_request(request):
mp = request.getfixturevalue("monkeypatch")
except AttributeError: # pytest < 3
mp = request.getfuncargvalue("monkeypatch")
mp.setattr(template_module.core.TemplateClass, '_request',
mp.setattr(higal.core.HiGalClass, '_request',
nonremote_request)
return mp


# finally test the methods using the mock HTTP response
def test_query_object(patch_request):
result = template_module.core.TemplateClass().query_object('m1')
result = higal.core.HiGalClass().query_object('m1')
assert isinstance(result, Table)

# similarly fill in tests for each of the methods
# look at tests in existing modules for more examples

0 comments on commit c7f5c18

Please sign in to comment.