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

Function test_eval_dask_comparison

xarray/tests/test_eval.py:556–571  ·  view source on GitHub ↗

Test that comparison operations preserve dask backing.

()

Source from the content-addressed store, hash-verified

554
555@requires_dask
556def test_eval_dask_comparison() -> None:
557 """Test that comparison operations preserve dask backing."""
558 from xarray.core.utils import is_duck_dask_array
559
560 ds = Dataset(
561 {"a": ("x", np.arange(10.0)), "b": ("x", np.arange(10.0)[::-1])}
562 ).chunk({"x": 5})
563
564 with raise_if_dask_computes():
565 result = ds.eval("a > b")
566
567 assert is_duck_dask_array(result.data)
568
569 # Verify correctness
570 expected = ds["a"] > ds["b"]
571 assert_equal(result, expected)
572
573
574@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…