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

Function test_eval_dask_basic_arithmetic

xarray/tests/test_eval.py:416–432  ·  view source on GitHub ↗

Test that basic arithmetic with dask arrays returns dask-backed result.

()

Source from the content-addressed store, hash-verified

414
415@requires_dask
416def test_eval_dask_basic_arithmetic() -> None:
417 """Test that basic arithmetic with dask arrays returns dask-backed result."""
418 from xarray.core.utils import is_duck_dask_array
419
420 ds = Dataset(
421 {"a": ("x", np.arange(10.0)), "b": ("x", np.linspace(0, 1, 10))}
422 ).chunk({"x": 5})
423
424 with raise_if_dask_computes():
425 result = ds.eval("a + b")
426
427 assert isinstance(result, DataArray)
428 assert is_duck_dask_array(result.data)
429
430 # Verify correctness when computed
431 expected = ds["a"] + ds["b"]
432 assert_equal(result, expected)
433
434
435@requires_dask

Callers

nothing calls this directly

Calls 8

DatasetClass · 0.90
raise_if_dask_computesFunction · 0.90
is_duck_dask_arrayFunction · 0.90
assert_equalFunction · 0.90
arangeMethod · 0.80
linspaceMethod · 0.80
evalMethod · 0.80
chunkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…