Skip to content

Commit

Permalink
Merge pull request #2347 from oda-hub/fix-degree-representation
Browse files Browse the repository at this point in the history
freeze degree string representation
  • Loading branch information
bsipocz authored Mar 30, 2022
2 parents db3f08b + a1beaaf commit c081ee4
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion astroquery/heasarc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ def query_region_async(self, position: Union[coordinates.SkyCoord, str],
kwargs['equinox'] = 2000

# Generate the request
# Fixed string representation of coordinates ensures that request payload
# does not depend on python/astropy version for the same input coordinates
request_payload = self._args_to_payload(
mission=mission,
entry="{},{}".format(c.ra.degree, c.dec.degree),
entry=f"{c.ra.degree:.10f},{c.dec.degree:.10f}",
radius=u.Quantity(radius),
**kwargs
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion astroquery/heasarc/tests/parametrization.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os
import glob
import hashlib
Expand Down Expand Up @@ -40,7 +41,11 @@ def fileid_for_request(url, params):

def filename_for_request(url, params, output=False):
fileid = fileid_for_request(url, params)
return data_path(fileid, output=output)

filename = data_path(fileid, output=output)
log.debug(f'constructed filename {filename} for request: ' + json.dumps(dict(url=url, params=params), sort_keys=True, indent=4))

return filename


def get_mockreturn(session, method, url, params=None, timeout=10, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions astroquery/heasarc/tests/test_heasarc_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_custom_args(self):
time="2020-09-01 .. 2020-12-01",
resultmax=10,
good_isgri=">1000",
cache=False
)

def test_filter_custom_args(self):
Expand Down
1 change: 1 addition & 0 deletions astroquery/heasarc/tests/test_heasarc_remote_isdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_custom_args(self):
time="2020-09-01 .. 2020-12-01",
resultmax=10,
good_isgri=">1000",
cache=False
)

def test_filter_custom_args(self):
Expand Down

0 comments on commit c081ee4

Please sign in to comment.