Test that bitwise boolean operators preserve dask.
()
| 573 | |
| 574 | @requires_dask |
| 575 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…