Test that basic arithmetic with dask arrays returns dask-backed result.
()
| 414 | |
| 415 | @requires_dask |
| 416 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…