Skip to content

Commit c081ee4

Browse files
authored
Merge pull request #2347 from oda-hub/fix-degree-representation
freeze degree string representation
2 parents db3f08b + a1beaaf commit c081ee4

File tree

9 files changed

+11
-2
lines changed

9 files changed

+11
-2
lines changed

astroquery/heasarc/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,11 @@ def query_region_async(self, position: Union[coordinates.SkyCoord, str],
169169
kwargs['equinox'] = 2000
170170

171171
# Generate the request
172+
# Fixed string representation of coordinates ensures that request payload
173+
# does not depend on python/astropy version for the same input coordinates
172174
request_payload = self._args_to_payload(
173175
mission=mission,
174-
entry="{},{}".format(c.ra.degree, c.dec.degree),
176+
entry=f"{c.ra.degree:.10f},{c.dec.degree:.10f}",
175177
radius=u.Quantity(radius),
176178
**kwargs
177179
)

astroquery/heasarc/tests/parametrization.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import os
23
import glob
34
import hashlib
@@ -40,7 +41,11 @@ def fileid_for_request(url, params):
4041

4142
def filename_for_request(url, params, output=False):
4243
fileid = fileid_for_request(url, params)
43-
return data_path(fileid, output=output)
44+
45+
filename = data_path(fileid, output=output)
46+
log.debug(f'constructed filename {filename} for request: ' + json.dumps(dict(url=url, params=params), sort_keys=True, indent=4))
47+
48+
return filename
4449

4550

4651
def get_mockreturn(session, method, url, params=None, timeout=10, **kwargs):

astroquery/heasarc/tests/test_heasarc_remote.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def test_custom_args(self):
2424
time="2020-09-01 .. 2020-12-01",
2525
resultmax=10,
2626
good_isgri=">1000",
27+
cache=False
2728
)
2829

2930
def test_filter_custom_args(self):

astroquery/heasarc/tests/test_heasarc_remote_isdc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_custom_args(self):
3232
time="2020-09-01 .. 2020-12-01",
3333
resultmax=10,
3434
good_isgri=">1000",
35+
cache=False
3536
)
3637

3738
def test_filter_custom_args(self):

0 commit comments

Comments
 (0)