Skip to content

Commit a4b7aba

Browse files
Added remote unit tests
1 parent 1f7db20 commit a4b7aba

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

astroquery/esa/hubble/tests/test_esa_hubble.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -603,24 +603,3 @@ def test_get_member_observations_attributeerror(self):
603603
ehst = ESAHubbleClass(self.get_dummy_tap_handler())
604604
dummy_obs_id = None
605605
ehst.get_member_observations(dummy_obs_id)
606-
607-
608-
"""
609-
def test_get_member_observations(self):
610-
parameters = {}
611-
obs = 'dummyObs'
612-
parameters['query'] = f"select observation_id from ehst.observation where members like '%{obs}%'"
613-
parameters['name'] = None
614-
parameters['output_file'] = None
615-
parameters['output_format'] = 'votable'
616-
parameters['verbose'] = False
617-
parameters['dump_to_file'] = False
618-
parameters['upload_resource'] = None
619-
parameters['upload_table_name'] = None
620-
621-
dummyTapHandler = DummyHubbleTapHandler("launch_job", parameters)
622-
tap = ESAHubbleClass(dummyTapHandler)
623-
624-
tap.get_member_observations(observation_id=obs)
625-
dummyTapHandler.check_call('launch_job', parameters)
626-
"""

astroquery/esa/hubble/tests/test_esa_hubble_remote.py

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ def remove_last_job():
4040

4141
@pytest.mark.remote_data
4242
class TestEsaHubbleRemoteData:
43-
4443
obs_query = "select top 2050 o.observation_id from ehst.observation o"
4544

4645
top_obs_query = "select top 100 o.observation_id from ehst.observation o"
4746

48-
hst_query = "select top 50 o.observation_id from ehst.observation "\
47+
hst_query = "select top 50 o.observation_id from ehst.observation " \
4948
"o where o.collection='HST'"
5049

51-
top_artifact_query = "select top 50 a.artifact_id, a.observation_id "\
50+
top_artifact_query = "select top 50 a.artifact_id, a.observation_id " \
5251
" from ehst.artifact a"
5352

5453
temp_folder = create_temp_folder()
@@ -75,12 +74,6 @@ def test_get_artifact(self):
7574
esa_hubble.get_artifact(artifact_id, temp_file)
7675
assert os.path.exists(temp_file)
7776

78-
def test_query_target(self):
79-
temp_file = self.temp_folder.name + "/" + "m31_query.xml"
80-
table = esa_hubble.query_target("m31", temp_file)
81-
assert os.path.exists(temp_file)
82-
assert 'OBSERVATION_ID' in table.columns
83-
8477
def test_cone_search(self):
8578
esa_hubble = ESAHubble()
8679
c = coordinates.SkyCoord("00h42m44.51s +41d16m08.45s", frame='icrs')
@@ -90,3 +83,42 @@ def test_cone_search(self):
9083
assert 'observation_id' in table.columns
9184
assert len(table) > 0
9285
remove_last_job()
86+
87+
# tests for get_related_members
88+
def test_hst_composite_to_hst_simple(self):
89+
esa_hubble = ESAHubble()
90+
result = esa_hubble.get_member_observations('jdrz0c010')
91+
assert result == ['jdrz0cjxq', 'jdrz0cjyq']
92+
93+
def test_hst_simple_to_hst_composite(self):
94+
esa_hubble = ESAHubble()
95+
result = esa_hubble.get_member_observations('jdrz0cjxq')
96+
assert result == ['jdrz0c010']
97+
98+
def test_hap_composite_to_hap_simple(self):
99+
esa_hubble = ESAHubble()
100+
result = esa_hubble.get_member_observations('hst_15446_4v_acs_wfc_f606w_jdrz4v')
101+
assert result == ['hst_15446_4v_acs_wfc_f606w_jdrz4vkv', 'hst_15446_4v_acs_wfc_f606w_jdrz4vkw']
102+
103+
def test_hap_simple_to_hap_composite(self):
104+
esa_hubble = ESAHubble()
105+
result = esa_hubble.get_member_observations('hst_16316_71_acs_sbc_f150lp_jec071i9')
106+
assert result == ['hst_16316_71_acs_sbc_f150lp_jec071']
107+
108+
def test_hap_simple_to_hst_simple(self):
109+
esa_hubble = ESAHubble()
110+
result = esa_hubble.get_hap_hst_link('hst_16316_71_acs_sbc_f150lp_jec071i9')
111+
assert result == ['jec071i9q']
112+
113+
def test_hst_simple_to_hap_simple(self):
114+
esa_hubble = ESAHubble()
115+
result = esa_hubble.get_hap_hst_link('jec071i9q')
116+
assert result == ['hst_16316_71_acs_sbc_f150lp_jec071i9']
117+
118+
"""
119+
def test_query_target(self):
120+
temp_file = self.temp_folder.name + "/" + "m31_query.xml"
121+
table = esa_hubble.query_target("m31", temp_file)
122+
assert os.path.exists(temp_file)
123+
assert 'OBSERVATION_ID' in table.columns
124+
"""

0 commit comments

Comments
 (0)