Skip to content

Commit

Permalink
Catch warnings caused by currently stale sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenbrot committed Feb 4, 2025
1 parent aa8af14 commit 8d605d4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions dkist/dataset/tests/test_tiled_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from dkist import Dataset, TiledDataset, load_dataset
from dkist.tests.helpers import figure_test
from dkist.utils.exceptions import DKISTUserWarning


def test_tiled_dataset(simple_tiled_dataset, dataset):
Expand Down Expand Up @@ -90,7 +91,11 @@ def test_tileddataset_plot(share_zscale):
ds = TiledDataset(np.array(newtiles).reshape(ori_ds.shape), meta={"inventory": newtiles[0].inventory})

fig = plt.figure(figsize=(12, 15))
ds.plot(0, share_zscale=share_zscale, figure=fig)
with pytest.warns(DKISTUserWarning,
match="The metadata ASDF file that produced this dataset is out of date and will result in "
"incorrect plots. Please re-download the metadata ASDF file."):
#TODO: Once sample data have been updated maybe we should test both paths here (old data and new data)
ds.plot(0, share_zscale=share_zscale, figure=fig)

return plt.gcf()

Expand Down Expand Up @@ -119,7 +124,11 @@ def test_tileddataset_plot_limit_swapping(swap_tile_limits):
assert non_square_ds.shape[0] != non_square_ds.shape[1] # Just in case the underlying data change for some reason

fig = plt.figure(figsize=(12, 15))
non_square_ds.plot(0, share_zscale=False, swap_tile_limits=swap_tile_limits, figure=fig)
with pytest.warns(DKISTUserWarning,
match="The metadata ASDF file that produced this dataset is out of date and will result in "
"incorrect plots. Please re-download the metadata ASDF file."):
#TODO: Once sample data have been updated maybe we should test both paths here (old data and new data)
non_square_ds.plot(0, share_zscale=False, swap_tile_limits=swap_tile_limits, figure=fig)

assert fig.axes[0].get_gridspec().get_geometry() == non_square_ds.shape[::-1]
for ax in fig.axes:
Expand Down

0 comments on commit 8d605d4

Please sign in to comment.