Skip to content

Commit

Permalink
Explicitly state datetime units in array constructors in `test_dateti…
Browse files Browse the repository at this point in the history
…me_mean` (#5463)
  • Loading branch information
spencerkclark authored Jun 12, 2021
1 parent 2290a5f commit 5a14d7d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions xarray/tests/test_duck_array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,15 @@ def assert_dask_array(da, dask):
def test_datetime_mean(dask):
# Note: only testing numpy, as dask is broken upstream
da = DataArray(
np.array(["2010-01-01", "NaT", "2010-01-03", "NaT", "NaT"], dtype="M8"),
np.array(["2010-01-01", "NaT", "2010-01-03", "NaT", "NaT"], dtype="M8[ns]"),
dims=["time"],
)
if dask:
# Trigger use case where a chunk is full of NaT
da = da.chunk({"time": 3})

expect = DataArray(np.array("2010-01-02", dtype="M8"))
expect_nat = DataArray(np.array("NaT", dtype="M8"))
expect = DataArray(np.array("2010-01-02", dtype="M8[ns]"))
expect_nat = DataArray(np.array("NaT", dtype="M8[ns]"))

actual = da.mean()
if dask:
Expand Down Expand Up @@ -889,8 +889,6 @@ def test_push_dask():
# some chunks of size-1 with NaN
with raise_if_dask_computes():
actual = push(
dask.array.from_array(array, chunks=(1, 2, 3, 2, 2, 1, 1)),
axis=0,
n=None,
dask.array.from_array(array, chunks=(1, 2, 3, 2, 2, 1, 1)), axis=0, n=None
)
np.testing.assert_equal(actual, expected)

0 comments on commit 5a14d7d

Please sign in to comment.