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

Function test_more_transforms_pass_lazy_array_equiv

xarray/tests/test_dask.py:1763–1782  ·  view source on GitHub ↗
(map_da, map_ds)

Source from the content-addressed store, hash-verified

1761
1762
1763def test_more_transforms_pass_lazy_array_equiv(map_da, map_ds):
1764 with raise_if_dask_computes():
1765 assert_equal(map_ds.cxy.broadcast_like(map_ds.cxy), map_ds.cxy)
1766 assert_equal(xr.broadcast(map_ds.cxy, map_ds.cxy)[0], map_ds.cxy)
1767 assert_equal(map_ds.map(lambda x: x), map_ds)
1768 assert_equal(map_ds.set_coords("a").reset_coords("a"), map_ds)
1769 assert_equal(map_ds.assign({"a": map_ds.a}), map_ds)
1770
1771 # fails because of index error
1772 # assert_equal(
1773 # map_ds.rename_dims({"x": "xnew"}).rename_dims({"xnew": "x"}), map_ds
1774 # )
1775
1776 assert_equal(
1777 map_ds.rename_vars({"cxy": "cnew"}).rename_vars({"cnew": "cxy"}), map_ds
1778 )
1779
1780 assert_equal(map_da._from_temp_dataset(map_da._to_temp_dataset()), map_da)
1781 assert_equal(map_da.astype(map_da.dtype), map_da)
1782 assert_equal(map_da.transpose("y", "x", transpose_coords=False).cxy, map_da.cxy)
1783
1784
1785def test_optimize():

Callers

nothing calls this directly

Calls 12

raise_if_dask_computesFunction · 0.90
assert_equalFunction · 0.90
set_coordsMethod · 0.80
_from_temp_datasetMethod · 0.80
_to_temp_datasetMethod · 0.80
broadcast_likeMethod · 0.45
mapMethod · 0.45
reset_coordsMethod · 0.45
assignMethod · 0.45
rename_varsMethod · 0.45
astypeMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…