Blob Blame History Raw
From b99bc4807922b72bc5506f5ac2884aeb3c2da845 Mon Sep 17 00:00:00 2001
From: Keewis <keewis@posteo.de>
Date: Wed, 24 Jun 2020 20:24:54 +0200
Subject: [PATCH] use assert_allclose in the aggregation-with-units tests
 (#4174)

* use assert_allclose in the aggregation tests

* install pint using pip

Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
 xarray/tests/test_units.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xarray/tests/test_units.py b/xarray/tests/test_units.py
index 2826dc24..5dd5cfaf 100644
--- a/xarray/tests/test_units.py
+++ b/xarray/tests/test_units.py
@@ -1448,7 +1448,7 @@ class TestVariable(VariableSubclassobjects):
         actual = func(variable)
 
         assert_units_equal(expected, actual)
-        xr.testing.assert_identical(expected, actual)
+        assert_allclose(expected, actual)
 
     @pytest.mark.parametrize(
         "func",
@@ -2296,7 +2296,8 @@ class TestDataArray:
         expected = attach_units(func(strip_units(data_array)), units)
         actual = func(data_array)
 
-        assert_equal_with_units(expected, actual)
+        assert_units_equal(expected, actual)
+        assert_allclose(expected, actual)
 
     @pytest.mark.parametrize(
         "func",
@@ -3809,7 +3810,8 @@ class TestDataset:
             },
         )
 
-        assert_equal_with_units(actual, expected)
+        assert_units_equal(expected, actual)
+        assert_allclose(expected, actual)
 
     @pytest.mark.parametrize("property", ("imag", "real"))
     def test_numpy_properties(self, property, dtype):
-- 
2.25.4