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

Function test_eval_dask_boolean_operators

xarray/tests/test_eval.py:575–590  ·  view source on GitHub ↗

Test that bitwise boolean operators preserve dask.

()

Source from the content-addressed store, hash-verified

573
574@requires_dask
575def test_eval_dask_boolean_operators() -> None:
576 """Test that bitwise boolean operators preserve dask."""
577 from xarray.core.utils import is_duck_dask_array
578
579 ds = Dataset(
580 {"a": ("x", np.arange(10.0)), "b": ("x", np.arange(10.0)[::-1])}
581 ).chunk({"x": 5})
582
583 with raise_if_dask_computes():
584 result = ds.eval("(a > 3) & (b < 7)")
585
586 assert is_duck_dask_array(result.data)
587
588 # Verify correctness
589 expected = (ds["a"] > 3) & (ds["b"] < 7)
590 assert_equal(result, expected)
591
592
593@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…