Skip to content

Commit

Permalink
add test for datastores example plot function
Browse files Browse the repository at this point in the history
  • Loading branch information
leifdenby committed Nov 12, 2024
1 parent 772cc20 commit 89b10b5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_datastores.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
# First-party
from neural_lam.datastore import DATASTORES
from neural_lam.datastore.base import BaseRegularGridDatastore
from neural_lam.datastore.plot_example import plot_example_from_datastore
from tests.conftest import init_datastore_example


Expand Down Expand Up @@ -364,3 +365,21 @@ def test_dataarray_shapes(datastore_name):
)
# assert diff == 0 with tolerance 1e-6
assert torch.allclose(diff, torch.zeros_like(diff), atol=1e-6)


@pytest.mark.parametrize("datastore_name", DATASTORES.keys())
def test_plot_example_from_datastore(datastore_name):
"""Check that the `plot_example_from_datastore` function is implemented."""
datastore = init_datastore_example(datastore_name)
fig = plot_example_from_datastore(
category="static",
datastore=datastore,
col_dim="{category}_feature",
split="train",
standardize=True,
selection={},
index_selection={},
)

assert fig is not None
assert fig.get_axes()

0 comments on commit 89b10b5

Please sign in to comment.