Skip to content

Commit 1ec3a6f

Browse files
committed
Changes to allow nan functions to work with xarray
1 parent 520f3d7 commit 1ec3a6f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

cubed_xarray/tests/test_xarray.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ def test_transpose(self):
127127
v = self.lazy_var
128128
self.assertLazyAndIdentical(u.T, v.T)
129129

130-
@pytest.mark.xfail(
131-
reason="xarray uses np.pad which is not yet wired up to cubed.pad"
132-
)
130+
@pytest.mark.xfail(reason="needs pad mode='constant_values' in cubed")
133131
def test_shift(self):
134132
u = self.eager_var
135133
v = self.lazy_var
@@ -193,10 +191,8 @@ def test_pickle(self):
193191
def test_reduce(self):
194192
u = self.eager_var
195193
v = self.lazy_var
196-
# TODO: remove skipna=False (https://github.com/cubed-dev/cubed/issues/153)
197-
self.assertLazyAndAllClose(u.mean(skipna=False), v.mean(skipna=False))
194+
self.assertLazyAndAllClose(u.mean(), v.mean())
198195
# TODO: other reduce functions need work
199-
# self.assertLazyAndAllClose(u.mean(), v.mean())
200196
# self.assertLazyAndAllClose(u.std(), v.std())
201197
# with raise_if_cubed_computes():
202198
# actual = v.argmax(dim="x")
@@ -345,7 +341,7 @@ def test_lazy_array(self):
345341
self.assertLazyAndAllClose(u, v)
346342
self.assertLazyAndAllClose(-u, -v)
347343
self.assertLazyAndAllClose(u.T, v.T)
348-
# self.assertLazyAndAllClose(u.mean(), v.mean()) # TODO: isn't lazy
344+
self.assertLazyAndAllClose(u.mean(), v.mean())
349345
self.assertLazyAndAllClose(1 + u, 1 + v)
350346

351347
actual = xr.concat([v[:2], v[2:]], "x")
@@ -362,7 +358,6 @@ def test_compute(self):
362358

363359
assert ((u + 1).data == v2.data).all()
364360

365-
@pytest.mark.xfail(reason="isn't lazy")
366361
def test_groupby(self):
367362
u = self.eager_array
368363
v = self.lazy_array
@@ -372,7 +367,7 @@ def test_groupby(self):
372367
actual = v.groupby("x").mean(...)
373368
self.assertLazyAndAllClose(expected, actual)
374369

375-
@pytest.mark.xfail(reason="isn't lazy")
370+
@pytest.mark.xfail(reason="needs pad mode='constant_values' in cubed")
376371
def test_rolling(self):
377372
u = self.eager_array
378373
v = self.lazy_array

0 commit comments

Comments
 (0)