(obj)
| 1571 | "obj", [make_da(), make_da().compute(), make_ds(), make_ds().compute()] |
| 1572 | ) |
| 1573 | def 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()]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…