Skip to content

Commit 4880322

Browse files
rickynilssonbsipocz
authored andcommitted
Get base URL from config via get_access_url. Remove test_regularize_object_name. Fix doctest issues by adding +IGNORE OUTPUT. Fix remote test of query_aliases().
1 parent bf33cf7 commit 4880322

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

astroquery/ipac/nexsci/nasa_exoplanet_archive/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def query_aliases(self, object_name, *, cache=None):
391391
response : list
392392
A list of aliases found for the object name. The default name will be listed first.
393393
"""
394-
url = requests.get("https://exoplanetarchive.ipac.caltech.edu/cgi-bin/Lookup/nph-aliaslookup.py?objname="+object_name)
394+
url = requests.get(get_access_url('aliaslookup')+object_name)
395395
data = json.loads(url.text)
396396

397397
try:

astroquery/ipac/nexsci/nasa_exoplanet_archive/tests/test_nasa_exoplanet_archive.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,6 @@ def patch_get(request): # pragma: nocover
119119
return mp
120120

121121

122-
# def test_regularize_object_name(patch_get):
123-
# NasaExoplanetArchiveMock = NasaExoplanetArchiveClass()
124-
125-
# NasaExoplanetArchiveMock._tap_tables = ['list']
126-
# assert NasaExoplanetArchiveMock._regularize_object_name("kepler 2") == "HAT-P-7"
127-
# assert NasaExoplanetArchiveMock._regularize_object_name("kepler 1 b") == "TrES-2 b"
128-
129-
# with pytest.warns(NoResultsWarning) as warning:
130-
# NasaExoplanetArchiveMock._regularize_object_name("not a planet")
131-
# assert "No aliases found for name: 'not a planet'" == str(warning[0].message)
132-
133-
134122
def test_backwards_compat(patch_get):
135123
"""
136124
These are the tests from the previous version of this interface.

astroquery/ipac/nexsci/nasa_exoplanet_archive/tests/test_nasa_exoplanet_archive_remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_query_region():
159159
def test_query_aliases():
160160
name = "bet Pic"
161161
aliases = NasaExoplanetArchive.query_aliases(name)
162-
assert len(aliases) == 12
162+
assert len(aliases) > 10
163163
assert "HD 39060" in aliases
164164

165165

docs/ipac/nexsci/nasa_exoplanet_archive.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For example, the following query searches the ``ps`` table of confirmed exoplane
2727
.. doctest-remote-data::
2828

2929
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
30-
>>> NasaExoplanetArchive.query_object("K2-18 b")
30+
>>> NasaExoplanetArchive.query_object("K2-18 b") # doctest: +IGNORE_OUTPUT
3131
<QTable masked=True length=11>
3232
pl_name pl_letter hostname ... sy_kmagerr1 sy_kmagerr2 sky_coord
3333
... deg,deg
@@ -71,7 +71,7 @@ For example, a full table can be queried as follows:
7171
.. doctest-remote-data::
7272

7373
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
74-
>>> NasaExoplanetArchive.query_criteria(table="cumulative", select="*")
74+
>>> NasaExoplanetArchive.query_criteria(table="cumulative", select="*") # doctest: +IGNORE_OUTPUT
7575
<QTable masked=True length=9564>
7676
kepid kepoi_name kepler_name ... koi_fittype koi_score sky_coord
7777
... deg,deg
@@ -113,7 +113,7 @@ In this section, we demonstrate
113113

114114
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
115115
>>> NasaExoplanetArchive.query_criteria(table="pscomppars", select="top 10 pl_name,ra,dec",
116-
... where="disc_facility like '%TESS%'")
116+
... where="disc_facility like '%TESS%'") # doctest: +IGNORE_OUTPUT
117117
<QTable masked=True length=10>
118118
pl_name ra dec sky_coord
119119
deg deg deg,deg
@@ -155,7 +155,7 @@ In this section, we demonstrate
155155

156156
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
157157
>>> NasaExoplanetArchive.query_criteria(
158-
... table="pscomppars", where="hostname like 'Kepler%'", order="hostname")
158+
... table="pscomppars", where="hostname like 'Kepler%'", order="hostname") # doctest: +IGNORE_OUTPUT
159159
<QTable masked=True length=2370>
160160
pl_name pl_letter hostname ... htm20 sky_coord
161161
... deg,deg
@@ -182,7 +182,7 @@ In this section, we demonstrate
182182
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
183183
>>> NasaExoplanetArchive.query_criteria(
184184
... table="koi", where="koi_vet_date>to_date('2015-01-24','yyyy-mm-dd')",
185-
... select="kepoi_name,koi_vet_date", order="koi_vet_date")
185+
... select="kepoi_name,koi_vet_date", order="koi_vet_date") # doctest: +IGNORE_OUTPUT
186186
<QTable length=34652>
187187
kepoi_name koi_vet_date
188188
str9 str10

0 commit comments

Comments
 (0)