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

Method test_from_cupy

xarray/tests/test_dataset.py:8360–8369  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8358
8359 @requires_cupy
8360 def test_from_cupy(self) -> None:
8361 import cupy as cp
8362
8363 arr = np.array([1, 2, 3])
8364 ds = xr.Dataset(
8365 {"a": ("x", cp.array(arr))}, coords={"lat": ("x", cp.array(arr + 3))}
8366 )
8367
8368 expected = xr.Dataset({"a": ("x", [1, 2, 3])}, coords={"lat": ("x", arr + 3)})
8369 assert_identical(ds.as_numpy(), expected)
8370
8371 @requires_dask
8372 @requires_pint

Callers

nothing calls this directly

Calls 2

as_numpyMethod · 0.95
assert_identicalFunction · 0.90

Tested by

no test coverage detected