Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disabled tests #605

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tests/pytests/test_hayabusa2_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import spiceypy as spice

import ale
from ale.drivers.hayabusa2_drivers import Hayabusa2ONCIsisLabelNaifSpiceDriver
from ale.formatters.formatter import to_isd

from conftest import get_image_kernels, convert_kernels, get_image_label, compare_dicts, get_isd
Expand All @@ -20,7 +21,6 @@ def test_kernels():
for kern in binary_kernels:
os.remove(kern)

@pytest.mark.xfail
@pytest.mark.parametrize("label_type", ['isis3'])
def test_hayabusa_load(test_kernels, label_type):
label_file = get_image_label('hyb2_onc_20151203_084458_w2f_l2a', label_type)
Expand All @@ -29,3 +29,18 @@ def test_hayabusa_load(test_kernels, label_type):
compare_dict = get_isd('hayabusa2')
print(json.dumps(isd_obj, indent=2))
assert compare_dicts(isd_obj, compare_dict) == []

class test_hayabusa(unittest.TestCase):

def setUp(self):
label = get_image_label("hyb2_onc_20151203_084458_w2f_l2a", "isis3")
self.driver = Hayabusa2ONCIsisLabelNaifSpiceDriver(label)

def test_instrument_id(self):
assert self.driver.instrument_id == 'HAYABUSA2_ONC-W2'

def test_sensor_model_version(self):
assert self.driver.sensor_model_version == 1

def test_spacecraft_name(self):
assert self.driver.spacecraft_name == 'HAYABUSA2'
20 changes: 19 additions & 1 deletion tests/pytests/test_juno_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def test_kernels():
for kern in binary_kernels:
os.remove(kern)

@pytest.mark.xfail
@pytest.mark.parametrize("label_type", ['isis3'])
def test_mro_load(test_kernels, label_type):
label_file = get_image_label('JNCR_2016240_01M06152_V01', label_type)
Expand Down Expand Up @@ -51,3 +50,22 @@ def test_ephemeris_start_time(self):

def test_sensor_model_version(self):
assert self.driver.sensor_model_version == 1

def test_naif_keywords(self):
with patch('ale.base.data_naif.spice.bodvrd', return_value=[1000, 1000, 1000]) as bodvrd, \
patch('ale.base.data_naif.spice.bods2c', return_value=599) as bods2c, \
patch('ale.base.data_naif.spice.cidfrm', return_value=(10015, 'IAU_JUPITER')) as cidfrm:

naif_keywords = {
"BODY599_RADII" : 1000,
"BODY_CODE" : 599,
"BODY_FRAME_CODE" : 10015
}

assert self.driver.naif_keywords["BODY_CODE"] == naif_keywords["BODY_CODE"]
assert self.driver.naif_keywords["BODY599_RADII"] == naif_keywords["BODY599_RADII"]
assert self.driver.naif_keywords["BODY_FRAME_CODE"] == naif_keywords["BODY_FRAME_CODE"]

bodvrd.assert_called_with('JUPITER', 'RADII', 3)
bods2c.assert_called_with('JUPITER')
cidfrm.assert_called_with(599)
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,41 @@ def test_start_time(self):
def test_sensor_model_version(self):
assert self.driver.sensor_model_version == 1

def test_ikid(self):
assert self.driver.ikid == -53031

def test_sampling_factor(self):
assert self.driver.sampling_factor == 1

def test_ephemeris_start_time(self):
with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=400001111.2222333) as scs2e:
assert self.driver.ephemeris_start_time == 400001111.4885301

def test_ephemeris_stop_time(self):
with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=400001111.2222333) as scs2e:
assert self.driver.ephemeris_stop_time == 400001127.9656446

def test_focal_length(self):
assert self.driver.focal_length == 203.9213

def test_detector_center_sample(self):
assert self.driver.detector_center_sample == 160.0

def test_detector_center_line(self):
assert self.driver.detector_center_line == 0

def test_tdi_mode(self):
assert self.driver.tdi_mode == "ENABLED"

def test_sensor_name(self):
assert self.driver.sensor_name == "MARS_ODYSSEY"

def test_band_times(self):
with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=400001111.2222333) as scs2e:
assert self.driver.band_times == [400001111.4885301,
400001112.0211237, 400001112.8865883, 400001113.7520529,
400001114.6175175, 400001115.4829821, 400001116.34844667,
400001117.2139113, 400001118.0460888, 400001118.9115534]

class test_themisvis_isis_naif(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -120,13 +155,13 @@ def test_detector_center_line(self):

def test_detector_center_sample(self):
assert self.driver.detector_center_sample == 512

def test_framelets_flipped(self):
assert self.driver.framelets_flipped == True

def test_sampling_factor(self):
assert self.driver.sampling_factor == 1

def test_sensor_names(self):
assert self.driver.sensor_name == "MARS_ODYSSEY"

def test_num_frames(self):
assert self.driver.num_frames == 19

Expand All @@ -138,4 +173,8 @@ def test_interframe_delay(self):

def test_band_times(self):
with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=392211096.4307215) as scs2e:
assert self.driver.band_times == [392211098.2259215]
assert self.driver.band_times == [392211098.2259215]

def test_framelets_flipped(self):
assert self.driver.framelets_flipped == True

Loading