diff --git a/src/extra.py b/src/extra.py index 699a1e5145efa036aa43ea48bd32602bcb3b186b..6269cb9cc61dbd1fb679da9c962bf3a89f5d521d 100644 --- a/src/extra.py +++ b/src/extra.py @@ -136,6 +136,8 @@ def check_operator(op, loc, tol=1e-12, ntries=100, perf_check=True, def assert_allclose(f1, f2, atol=0, rtol=1e-7): if isinstance(f1, Field): return np.testing.assert_allclose(f1.val, f2.val, atol=atol, rtol=rtol) + if f1.domain is not f2.domain: + raise AssertionError for key, val in f1.items(): assert_allclose(val, f2[key], atol=atol, rtol=rtol) @@ -143,6 +145,8 @@ def assert_allclose(f1, f2, atol=0, rtol=1e-7): def assert_equal(f1, f2): if isinstance(f1, Field): return np.testing.assert_equal(f1.val, f2.val) + if f1.domain is not f2.domain: + raise AssertionError for key, val in f1.items(): assert_equal(val, f2[key])