Skip to content

Commit

Permalink
Cleanup a photom test (#1536)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson authored Dec 11, 2024
1 parent 9cdaf94 commit e250097
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions romancal/photom/tests/test_photom.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

import numpy as np
import pytest
from astropy import units as u
Expand Down Expand Up @@ -105,19 +103,16 @@ def test_no_photom_match():
input_model.meta.photometry.pixel_area = -1.0
input_model.meta.photometry.conversion_megajanskys = -1.0

with warnings.catch_warnings(record=True) as caught:
with pytest.warns(
UserWarning,
match=f"No matching photom parameters for {input_model.meta.instrument.optical_element}",
):
# Look for now non existent F146 optical element
output_model = photom.apply_photom(input_model, photom_model)

# Assert warning key matches that of the input file
assert (
str(caught[0].message).split()[-1]
== input_model.meta.instrument.optical_element
)

# Assert that photom elements are not updated
assert output_model.meta.photometry.pixel_area == -1.0
assert output_model.meta.photometry.conversion_megajanskys == -1.0
# Assert that photom elements are not updated
assert output_model.meta.photometry.pixel_area == -1.0
assert output_model.meta.photometry.conversion_megajanskys == -1.0


def test_apply_photom1():
Expand Down

0 comments on commit e250097

Please sign in to comment.