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

Function test_eval_dask_chained_comparisons

xarray/tests/test_eval.py:594–607  ·  view source on GitHub ↗

Test that chained comparisons preserve dask backing.

()

Source from the content-addressed store, hash-verified

592
593@requires_dask
594def 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)

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…