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

Function test_recursive_token

xarray/tests/test_dask.py:1655–1678  ·  view source on GitHub ↗

Test that tokenization is invoked recursively, and doesn't just rely on the output of str()

()

Source from the content-addressed store, hash-verified

1653
1654
1655def test_recursive_token():
1656 """Test that tokenization is invoked recursively, and doesn't just rely on the
1657 output of str()
1658 """
1659 a = np.ones(10000)
1660 b = np.ones(10000)
1661 b[5000] = 2
1662 assert str(a) == str(b)
1663 assert dask.base.tokenize(a) != dask.base.tokenize(b)
1664
1665 # Test DataArray and Variable
1666 da_a = DataArray(a)
1667 da_b = DataArray(b)
1668 assert dask.base.tokenize(da_a) != dask.base.tokenize(da_b)
1669
1670 # Test Dataset
1671 ds_a = da_a.to_dataset(name="x")
1672 ds_b = da_b.to_dataset(name="x")
1673 assert dask.base.tokenize(ds_a) != dask.base.tokenize(ds_b)
1674
1675 # Test IndexVariable
1676 da_a = DataArray(a, dims=["x"], coords={"x": a})
1677 da_b = DataArray(a, dims=["x"], coords={"x": b})
1678 assert dask.base.tokenize(da_a) != dask.base.tokenize(da_b)
1679
1680
1681@requires_scipy_or_netCDF4

Callers

nothing calls this directly

Calls 2

to_datasetMethod · 0.95
DataArrayClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…