Skip to content

Commit 5121d86

Browse files
authored
use assert_allclose in the aggregation-with-units tests (#4174)
* use assert_allclose in the aggregation tests * install pint using pip
1 parent 3088de2 commit 5121d86

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

ci/requirements/py36-min-nep18.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ dependencies:
1111
- msgpack-python=0.6 # remove once distributed is bumped. distributed GH3491
1212
- numpy=1.17
1313
- pandas=0.25
14-
- pint
1514
- pip
1615
- pytest
1716
- pytest-cov
1817
- pytest-env
1918
- scipy=1.2
2019
- setuptools=41.2
2120
- sparse=0.8
21+
- pip:
22+
- pint==0.13

ci/requirements/py36.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies:
2828
- numba
2929
- numpy
3030
- pandas
31-
- pint
3231
- pip
3332
- pseudonetcdf
3433
- pydap
@@ -45,3 +44,4 @@ dependencies:
4544
- zarr
4645
- pip:
4746
- numbagg
47+
- pint

ci/requirements/py37-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies:
2828
- numba
2929
- numpy
3030
- pandas
31-
- pint
3231
- pip
3332
- pseudonetcdf
3433
- pydap
@@ -45,3 +44,4 @@ dependencies:
4544
- zarr
4645
- pip:
4746
- numbagg
47+
- pint

ci/requirements/py37.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies:
2828
- numba
2929
- numpy
3030
- pandas
31-
- pint
3231
- pip
3332
- pseudonetcdf
3433
- pydap
@@ -45,3 +44,4 @@ dependencies:
4544
- zarr
4645
- pip:
4746
- numbagg
47+
- pint

ci/requirements/py38-all-but-dask.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ dependencies:
2525
- numba
2626
- numpy
2727
- pandas
28-
- pint
2928
- pip
3029
- pseudonetcdf
3130
- pydap
@@ -42,3 +41,4 @@ dependencies:
4241
- zarr
4342
- pip:
4443
- numbagg
44+
- pint

ci/requirements/py38.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies:
2828
- numba
2929
- numpy
3030
- pandas
31-
- pint
3231
- pip
3332
- pseudonetcdf
3433
- pydap
@@ -45,3 +44,4 @@ dependencies:
4544
- zarr
4645
- pip:
4746
- numbagg
47+
- pint

xarray/tests/test_units.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ def test_aggregation(self, func, dtype):
14381438
actual = func(variable)
14391439

14401440
assert_units_equal(expected, actual)
1441-
xr.testing.assert_identical(expected, actual)
1441+
assert_allclose(expected, actual)
14421442

14431443
# TODO: remove once pint==0.12 has been released
14441444
@pytest.mark.xfail(
@@ -2296,7 +2296,7 @@ def test_aggregation(self, func, dtype):
22962296
actual = func(data_array)
22972297

22982298
assert_units_equal(expected, actual)
2299-
xr.testing.assert_allclose(expected, actual)
2299+
assert_allclose(expected, actual)
23002300

23012301
@pytest.mark.parametrize(
23022302
"func",
@@ -3861,7 +3861,7 @@ def test_aggregation(self, func, dtype):
38613861
expected = attach_units(func(strip_units(ds)), units)
38623862

38633863
assert_units_equal(expected, actual)
3864-
assert_equal(expected, actual)
3864+
assert_allclose(expected, actual)
38653865

38663866
@pytest.mark.parametrize("property", ("imag", "real"))
38673867
def test_numpy_properties(self, property, dtype):

0 commit comments

Comments
 (0)