Skip to content

Commit

Permalink
defer to numpy for the expected result (pydata#7875)
Browse files Browse the repository at this point in the history
* simplify the test for unary funcs

* use `full_like` to construct the expected result

* Revert "use `full_like` to construct the expected result"

This reverts commit a14aeb5.
  • Loading branch information
keewis authored and dstansby committed Jun 28, 2023
1 parent 86a767b commit a283767
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions xarray/tests/test_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

import xarray as xr
from xarray.tests import assert_array_equal, mock
from xarray.tests import assert_allclose, assert_array_equal, mock
from xarray.tests import assert_identical as assert_identical_


Expand All @@ -16,16 +16,16 @@ def assert_identical(a, b):
assert_array_equal(a, b)


def test_unary():
args = [
0,
np.zeros(2),
@pytest.mark.parametrize(
"a",
[
xr.Variable(["x"], [0, 0]),
xr.DataArray([0, 0], dims="x"),
xr.Dataset({"y": ("x", [0, 0])}),
]
for a in args:
assert_identical(a + 1, np.cos(a))
],
)
def test_unary(a):
assert_allclose(a + 1, np.cos(a))


def test_binary():
Expand Down

0 comments on commit a283767

Please sign in to comment.