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

Function test_token_changes_when_data_changes

xarray/tests/test_dask.py:1573–1596  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1571 "obj", [make_da(), make_da().compute(), make_ds(), make_ds().compute()]
1572)
1573def test_token_changes_when_data_changes(obj):
1574 with raise_if_dask_computes():
1575 t1 = dask.base.tokenize(obj)
1576
1577 # Change data_var
1578 if isinstance(obj, DataArray):
1579 obj *= 2
1580 else:
1581 obj["a"] *= 2
1582 with raise_if_dask_computes():
1583 t2 = dask.base.tokenize(obj)
1584 assert t2 != t1
1585
1586 # Change non-index coord
1587 obj.coords["ndcoord"] *= 2
1588 with raise_if_dask_computes():
1589 t3 = dask.base.tokenize(obj)
1590 assert t3 != t2
1591
1592 # Change IndexVariable
1593 obj = obj.assign_coords(x=obj.x * 2)
1594 with raise_if_dask_computes():
1595 t4 = dask.base.tokenize(obj)
1596 assert t4 != t3
1597
1598
1599@pytest.mark.parametrize("obj", [make_da().compute(), make_ds().compute()])

Callers

nothing calls this directly

Calls 2

raise_if_dask_computesFunction · 0.90
assign_coordsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…