Skip to content

Commit

Permalink
Add comments dict to meta test fixture.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRyanIrish committed Oct 6, 2020
1 parent e2bece1 commit b8b83d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 14 additions & 9 deletions sunraster/tests/test_spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ def spice_fits_header():

@pytest.fixture
def spice_meta(spice_fits_header):
return SPICEMeta(spice_fits_header)
return SPICEMeta(spice_fits_header,
comments=zip(spice_fits_header.keys(), spice_fits_header.comments))


def _construct_expected_time(date_info):
return Time(date_info[0], format="fits", scale=date_info[1][1:4].lower())


def test_meta_spectral_window(spice_meta):
Expand Down Expand Up @@ -111,29 +116,29 @@ def test_meta_observing_mode_id(spice_meta):


def test_meta_observatory_radial_velocity(spice_meta):
assert spice_meta.observatory_radial_velocity == OBSERVATORY_RADIAL_VELOCITY[0]
assert spice_meta.observatory_radial_velocity == OBSERVATORY_RADIAL_VELOCITY[0] * u.m / u.s


def test_meta_distance_to_sun(spice_meta):
assert spice_meta.distance_to_sun == DISTANCE_TO_SUN[0] * u.m


def test_meta_date_reference(spice_meta):
assert spice_meta.date_reference == DATE_REFERENCE[0]
assert spice_meta.date_reference == _construct_expected_time(DATE_REFERENCE)


def test_meta_date_start(spice_meta):
assert spice_meta.date_start == DATE_START[0]
assert spice_meta.date_start == _construct_expected_time(DATE_START)


def test_meta_date_end(spice_meta):
assert spice_meta.date_end == DATE_END[0]
assert spice_meta.date_end == _construct_expected_time(DATE_END)


def test_meta_observer_coordinate(spice_meta):
obstime = Time(DATE_REFERENCE[0], format="fits", scale="utc")
obstime = _construct_expected_time(DATE_REFERENCE)
observer_coordinate = SkyCoord(
lon=HGLN_OBS[0]*u.deg, lat=HGLT_OBS[0]*u.deg, radius=DISTANCE_TO_SUN[0],
lon=HGLN_OBS[0], lat=HGLT_OBS[0], radius=DISTANCE_TO_SUN[0],
unit=(u.deg, u.deg, u.m), obstime=obstime, frame=HeliographicStonyhurst)
assert spice_meta.observer_coordinate.lon == observer_coordinate.lon
assert spice_meta.observer_coordinate.lat == observer_coordinate.lat
Expand Down Expand Up @@ -191,10 +196,10 @@ def test_meta_carrington_rotation(spice_meta):


def test_meta_date_start_earth(spice_meta):
date_start_earth = Time(DATE_START_EARTH[0], format="fits", scale="utc")
date_start_earth = _construct_expected_time(DATE_START_EARTH)
assert spice_meta.date_start_earth == date_start_earth


def test_meta_date_start_sun(spice_meta):
date_start_sun = Time(DATE_START_SUN[0], format="fits", scale="utc")
date_start_sun = _construct_expected_time(DATE_START_SUN)
assert spice_meta.date_start_sun == date_start_sun
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ deps =
# of key dependencies.
devdeps: cython
devdeps: git+https://github.com/astropy/astropy
devdeps: git+https://github.com/sunpy/ndcube
devdeps: git+https://github.com/DanRyanIrish/ndcube@1.3_doc_fix
devdeps: git+https://github.com/sunpy/sunpy
# ndcube uses a different version of ndcube to the other environments.
ndcube: ndcube<2.0.0
Expand Down Expand Up @@ -77,7 +77,7 @@ commands =
sphinx-build --color -W --keep-going -b html -d _build/.doctrees . _build/html {posargs}
python -c 'import pathlib; print("Documentation available under file://\{0\}".format(pathlib.Path(r"{toxinidir}") / "docs" / "_build" / "index.html"))'
deps =
git+https://github.com/sunpy/ndcube@1.3
git+https://github.com/DanRyanIrish/ndcube@1.3_doc_fix

[testenv:codestyle]
skip_install = true
Expand Down

0 comments on commit b8b83d4

Please sign in to comment.