MCPcopy
hub / github.com/pydata/xarray / test_from_pint_wrapping_dask

Method test_from_pint_wrapping_dask

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

Source from the content-addressed store, hash-verified

8371 @requires_dask
8372 @requires_pint
8373 def test_from_pint_wrapping_dask(self) -> None:
8374 import dask
8375 from pint import Quantity
8376
8377 arr = np.array([1, 2, 3])
8378 d = dask.array.from_array(arr)
8379 ds = xr.Dataset(
8380 {"a": ("x", Quantity(d, units="Pa"))},
8381 coords={"lat": ("x", Quantity(d, units="m") * 2)},
8382 )
8383
8384 result = ds.as_numpy()
8385 expected = xr.Dataset({"a": ("x", arr)}, coords={"lat": ("x", arr * 2)})
8386 assert_identical(result, expected)
8387
8388
8389def test_string_keys_typing() -> None:

Callers

nothing calls this directly

Calls 3

as_numpyMethod · 0.95
assert_identicalFunction · 0.90
from_arrayMethod · 0.45

Tested by

no test coverage detected