Skip to content
/ xarray Public
forked from pydata/xarray

Commit

Permalink
use full_like to construct the expected result
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed May 20, 2023
1 parent aad606a commit a14aeb5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 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_allclose, assert_array_equal, mock
from xarray.tests import assert_array_equal, mock
from xarray.tests import assert_identical as assert_identical_


Expand All @@ -25,7 +25,12 @@ def assert_identical(a, b):
],
)
def test_unary(a):
assert_allclose(a + 1, np.cos(a))
fill_value = np.cos(0)

expected = xr.full_like(a, fill_value=fill_value, dtype=fill_value.dtype)
actual = np.cos(a)

assert_identical(actual, expected)


def test_binary():
Expand Down

0 comments on commit a14aeb5

Please sign in to comment.