From e1c3ff47ab4de329606a48be5082b8311891ceea Mon Sep 17 00:00:00 2001 From: Peter Kraus Date: Wed, 20 Nov 2024 12:49:51 +0100 Subject: [PATCH] Add metadata tests. --- tests/test_99_example_counter.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_99_example_counter.py b/tests/test_99_example_counter.py index 8fb0696..ddf7116 100644 --- a/tests/test_99_example_counter.py +++ b/tests/test_99_example_counter.py @@ -21,7 +21,7 @@ ("counter_multistep", 15, "results.1"), ], ) -def test_counter_npoints( +def test_counter_npoints_metadata( casename, npoints, prefix, datadir, start_tomato_daemon, stop_tomato_daemon ): os.chdir(datadir) @@ -40,6 +40,8 @@ def test_counter_npoints( ds = dt["counter"] print(f"{ds=}") assert ds["uts"].size == npoints + assert "tomato_version" in dt.attrs + assert "tomato_Job" in dt.attrs @pytest.mark.parametrize( @@ -70,7 +72,7 @@ def test_counter_cancel(casename, datadir, start_tomato_daemon, stop_tomato_daem ("counter_snapshot", False), ], ) -def test_counter_snapshot( +def test_counter_snapshot_metadata( casename, external, datadir, start_tomato_daemon, stop_tomato_daemon ): os.chdir(datadir) @@ -85,6 +87,9 @@ def test_counter_snapshot( status = utils.job_status(1) assert status == "c" assert os.path.exists("snapshot.1.nc") + dt = xr.open_datatree("snapshot.1.nc") + assert "tomato_version" in dt.attrs + assert "tomato_Job" in dt.attrs @pytest.mark.parametrize(