Skip to content

Commit 93802ff

Browse files
authored
Merge pull request #442 from ecmwf/fix/ci-python-numerics
Fix failing test due to numeric precision
2 parents a1714e0 + b8c49de commit 93802ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test_50_xarray_getitem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os.path
22

3+
import numpy as np
34
import pytest
45

56
xr = pytest.importorskip("xarray") # noqa
@@ -39,7 +40,7 @@ def test_getitem_slice(cache: bool) -> None:
3940
assert da.isel(number=slice(2, 6, 2)).mean() == va[2:6:2].mean()
4041
# NOTE: label based indexing in xarray is inclusive of both the start and stop bounds.
4142
assert da.sel(number=slice(2, 6)).mean() == va[2:7].mean()
42-
assert da.sel(number=slice(2, 6, 2)).mean() == va[2:7:2].mean()
43+
assert np.isclose(da.sel(number=slice(2, 6, 2)).mean(), va[2:7:2].mean())
4344

4445

4546
@pytest.mark.parametrize("cache", [True, False])

0 commit comments

Comments
 (0)