Skip to content

Commit a14aeb5

Browse files
committed
use full_like to construct the expected result
1 parent aad606a commit a14aeb5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

xarray/tests/test_ufuncs.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
import xarray as xr
7-
from xarray.tests import assert_allclose, assert_array_equal, mock
7+
from xarray.tests import assert_array_equal, mock
88
from xarray.tests import assert_identical as assert_identical_
99

1010

@@ -25,7 +25,12 @@ def assert_identical(a, b):
2525
],
2626
)
2727
def test_unary(a):
28-
assert_allclose(a + 1, np.cos(a))
28+
fill_value = np.cos(0)
29+
30+
expected = xr.full_like(a, fill_value=fill_value, dtype=fill_value.dtype)
31+
actual = np.cos(a)
32+
33+
assert_identical(actual, expected)
2934

3035

3136
def test_binary():

0 commit comments

Comments
 (0)