MCPcopy Index your code
hub / github.com/pydata/xarray / test_array_interface

Method test_array_interface

xarray/tests/test_dataarray.py:2467–2479  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2465 assert_identical(dv, self.dv)
2466
2467 def test_array_interface(self) -> None:
2468 assert_array_equal(np.asarray(self.dv), self.x)
2469 # test patched in methods
2470 assert_array_equal(self.dv.astype(float), self.v.astype(float))
2471 assert_array_equal(self.dv.argsort(), self.v.argsort())
2472 assert_array_equal(self.dv.clip(2, 3), self.v.clip(2, 3))
2473 # test ufuncs
2474 expected = deepcopy(self.ds)
2475 expected["foo"][:] = np.sin(self.x)
2476 assert_equal(expected["foo"], np.sin(self.dv))
2477 assert_array_equal(self.dv, np.maximum(self.v, self.dv))
2478 bar = Variable(["x", "y"], np.zeros((10, 20)))
2479 assert_equal(self.dv, np.maximum(self.dv, bar))
2480
2481 def test_astype_attrs(self) -> None:
2482 # Split into two loops for mypy - Variable, DataArray, and Dataset

Callers

nothing calls this directly

Calls 6

assert_equalFunction · 0.90
VariableClass · 0.90
sinMethod · 0.80
astypeMethod · 0.45
argsortMethod · 0.45
clipMethod · 0.45

Tested by

no test coverage detected