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

Function test_eval_dask_np_functions

xarray/tests/test_eval.py:539–552  ·  view source on GitHub ↗

Test that numpy functions via np namespace preserve dask.

()

Source from the content-addressed store, hash-verified

537
538@requires_dask
539def test_eval_dask_np_functions() -> None:
540 """Test that numpy functions via np namespace preserve dask."""
541 from xarray.core.utils import is_duck_dask_array
542
543 ds = Dataset({"a": ("x", np.arange(1.0, 11.0))}).chunk({"x": 5})
544
545 with raise_if_dask_computes():
546 result = ds.eval("np.sqrt(a)")
547
548 assert is_duck_dask_array(result.data)
549
550 # Verify correctness
551 expected = np.sqrt(ds["a"])
552 assert_equal(result, expected)
553
554
555@requires_dask

Callers

nothing calls this directly

Calls 7

DatasetClass · 0.90
raise_if_dask_computesFunction · 0.90
is_duck_dask_arrayFunction · 0.90
assert_equalFunction · 0.90
arangeMethod · 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…