Skip to content

Commit

Permalink
add ignores in other tests that explicitly call extra_fits
Browse files Browse the repository at this point in the history
  • Loading branch information
emolter committed Feb 12, 2025
1 parent c91d54f commit 845569d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/stdatamodels/jwst/datamodels/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ def test_update_from_datamodel(tmp_path, datamodel_for_update, only, extra_fits)
# Verify the fixture returns keywords we expect
assert oldim.meta.telescope == "JWST"
assert oldim.meta.wcsinfo.crval1 == 5
assert oldim.extra_fits.PRIMARY.header == [["FOO", "BAR", ""]]
assert oldim.extra_fits.SCI.header == [["BAZ", "BUZ", ""]]
with pytest.raises(DeprecationWarning, "Manipulation of extra_fits is deprecated"):
assert oldim.extra_fits.PRIMARY.header == [["FOO", "BAR", ""]]
assert oldim.extra_fits.SCI.header == [["BAZ", "BUZ", ""]]

newim.update(oldim, only=only, extra_fits=extra_fits)
newim.save(path)
Expand Down
17 changes: 10 additions & 7 deletions tests/test_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def test_extra_fits(tmp_path):
hdul.writeto(file_path, overwrite=True)

with DataModel(file_path) as dm:
assert any(h for h in dm.extra_fits.PRIMARY.header if h == ["FOO", "BAR", ""])
with pytest.raises(DeprecationWarning, "Manipulation of extra_fits is deprecated"):
assert any(h for h in dm.extra_fits.PRIMARY.header if h == ["FOO", "BAR", ""])


def test_hdu_order(tmp_path):
Expand Down Expand Up @@ -600,19 +601,21 @@ def test_no_asdf_extension_extra_fits(tmp_path):
}

with PureFitsModel((5, 5)) as m:
m.extra_fits = {}
m.extra_fits.instance.update(extra_fits)
assert "ASDF" in m.extra_fits.instance
assert "CHECKSUM" in m.extra_fits.ASDF.header[0]
assert "DATASUM" in m.extra_fits.ASDF.header[1]
with pytest.raises(DeprecationWarning, "Manipulation of extra_fits is deprecated"):
m.extra_fits = {}
m.extra_fits.instance.update(extra_fits)
assert "ASDF" in m.extra_fits.instance
assert "CHECKSUM" in m.extra_fits.ASDF.header[0]
assert "DATASUM" in m.extra_fits.ASDF.header[1]
m.save(path)

with fits.open(path, memmap=False) as hdulist:
assert "ASDF" not in hdulist

with PureFitsModel(path) as m:
with pytest.raises(AttributeError):
m.extra_fits # noqa: B018
with pytest.raises(DeprecationWarning, "Manipulation of extra_fits is deprecated"):
m.extra_fits # noqa: B018


def test_ndarray_validation(tmp_path):
Expand Down

0 comments on commit 845569d

Please sign in to comment.