From 79f603468c2fd7c2291269e431d6f94894da1f3d Mon Sep 17 00:00:00 2001 From: James Penn Date: Tue, 4 May 2021 13:41:56 +0100 Subject: [PATCH 1/3] using AllClose for sqrt test --- lib/iris/tests/test_basic_maths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/iris/tests/test_basic_maths.py b/lib/iris/tests/test_basic_maths.py index c4d7b51a06..14df396915 100644 --- a/lib/iris/tests/test_basic_maths.py +++ b/lib/iris/tests/test_basic_maths.py @@ -554,7 +554,7 @@ def test_square_root(self): e = a ** 0.5 - self.assertArrayEqual(e.data, a.data ** 0.5) + self.assertArrayAllClose(e.data, a.data ** 0.5) self.assertCML(e, ("analysis", "sqrt.cml")) self.assertRaises(ValueError, iris.analysis.maths.exponentiate, a, 0.3) From d19dfba8384315cc833a3aa3c7be931f2afd87bd Mon Sep 17 00:00:00 2001 From: James Penn Date: Wed, 5 May 2021 15:04:37 +0100 Subject: [PATCH 2/3] Omitting the checksum from test cml --- lib/iris/tests/results/analysis/sqrt.cml | 2 +- lib/iris/tests/test_basic_maths.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/iris/tests/results/analysis/sqrt.cml b/lib/iris/tests/results/analysis/sqrt.cml index c6b9b88e9a..f8a1c48fc3 100644 --- a/lib/iris/tests/results/analysis/sqrt.cml +++ b/lib/iris/tests/results/analysis/sqrt.cml @@ -39,6 +39,6 @@ - + diff --git a/lib/iris/tests/test_basic_maths.py b/lib/iris/tests/test_basic_maths.py index 14df396915..f5ad3df5ca 100644 --- a/lib/iris/tests/test_basic_maths.py +++ b/lib/iris/tests/test_basic_maths.py @@ -554,8 +554,8 @@ def test_square_root(self): e = a ** 0.5 - self.assertArrayAllClose(e.data, a.data ** 0.5) - self.assertCML(e, ("analysis", "sqrt.cml")) + self.assertArrayEqual(e.data, a.data ** 0.5) + self.assertCML(e, ("analysis", "sqrt.cml"), checksum=False) self.assertRaises(ValueError, iris.analysis.maths.exponentiate, a, 0.3) def test_type_error(self): From 86aafb7f4f3c0981026406c4a8ce4f1b3aca7526 Mon Sep 17 00:00:00 2001 From: James Penn Date: Wed, 5 May 2021 15:40:50 +0100 Subject: [PATCH 3/3] use ArrayAllClose (rebase reset it?) --- lib/iris/tests/test_basic_maths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/iris/tests/test_basic_maths.py b/lib/iris/tests/test_basic_maths.py index f5ad3df5ca..2d045c684f 100644 --- a/lib/iris/tests/test_basic_maths.py +++ b/lib/iris/tests/test_basic_maths.py @@ -554,7 +554,7 @@ def test_square_root(self): e = a ** 0.5 - self.assertArrayEqual(e.data, a.data ** 0.5) + self.assertArrayAllClose(e.data, a.data ** 0.5) self.assertCML(e, ("analysis", "sqrt.cml"), checksum=False) self.assertRaises(ValueError, iris.analysis.maths.exponentiate, a, 0.3)