Test that chained comparisons preserve dask backing.
()
| 592 | |
| 593 | @requires_dask |
| 594 | def test_eval_dask_chained_comparisons() -> None: |
| 595 | """Test that chained comparisons preserve dask backing.""" |
| 596 | from xarray.core.utils import is_duck_dask_array |
| 597 | |
| 598 | ds = Dataset({"x": ("dim", np.arange(10.0))}).chunk({"dim": 5}) |
| 599 | |
| 600 | with raise_if_dask_computes(): |
| 601 | result = ds.eval("2 < x < 7") |
| 602 | |
| 603 | assert is_duck_dask_array(result.data) |
| 604 | |
| 605 | # Verify correctness |
| 606 | expected = (ds["x"] > 2) & (ds["x"] < 7) |
| 607 | assert_equal(result, expected) |
nothing calls this directly
no test coverage detected
searching dependent graphs…