From 69a3a884fce6e6f33a596a1fad02cde1afdb5ee4 Mon Sep 17 00:00:00 2001 From: Tom Body
Date: Thu, 30 Nov 2023 17:29:25 -0500 Subject: [PATCH] Align datasets before comparing --- tests/conftest.py | 2 ++ tests/test_regression_against_cases.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 9e4a7b42..6c3ed2e6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,8 @@ import pytest import yaml +import xarray as xr +xr.set_options(display_width=300) @pytest.fixture(scope="session") diff --git a/tests/test_regression_against_cases.py b/tests/test_regression_against_cases.py index 0513ae97..1fad8ea6 100644 --- a/tests/test_regression_against_cases.py +++ b/tests/test_regression_against_cases.py @@ -23,6 +23,7 @@ def test_regression_against_case(case: Path): reference_dataset = read_dataset_from_netcdf(Path(__file__).parent / "regression_results" / f"{case_name}_result.nc").load() + dataset, reference_dataset = xr.align(dataset, reference_dataset) assert_allclose(dataset, reference_dataset, rtol=1e-8, atol=0) @@ -35,9 +36,9 @@ def test_regression_against_case_with_update(case: Path): dataset = xr.Dataset(input_parameters) - for alg in algorithm.algorithms: # type: ignore - dataset = alg.update_dataset(dataset) + dataset = algorithm.update_dataset(dataset) reference_dataset = read_dataset_from_netcdf(Path(__file__).parent / "regression_results" / f"{case_name}_result.nc").load() + dataset, reference_dataset = xr.align(dataset, reference_dataset) assert_allclose(dataset, reference_dataset, rtol=1e-8, atol=0)