(compat)
| 1691 | "compat", ["broadcast_equals", "equals", "identical", "no_conflicts"] |
| 1692 | ) |
| 1693 | def test_lazy_array_equiv_variables(compat): |
| 1694 | var1 = xr.Variable(("y", "x"), da.zeros((10, 10), chunks=2)) |
| 1695 | var2 = xr.Variable(("y", "x"), da.zeros((10, 10), chunks=2)) |
| 1696 | var3 = xr.Variable(("y", "x"), da.zeros((20, 10), chunks=2)) |
| 1697 | |
| 1698 | with raise_if_dask_computes(): |
| 1699 | assert getattr(var1, compat)(var2, equiv=lazy_array_equiv) |
| 1700 | # values are actually equal, but we don't know that till we compute, return None |
| 1701 | with raise_if_dask_computes(): |
| 1702 | assert getattr(var1, compat)(var2 / 2, equiv=lazy_array_equiv) is None |
| 1703 | |
| 1704 | # shapes are not equal, return False without computes |
| 1705 | with raise_if_dask_computes(): |
| 1706 | assert getattr(var1, compat)(var3, equiv=lazy_array_equiv) is False |
| 1707 | |
| 1708 | # if one or both arrays are numpy, return None |
| 1709 | assert getattr(var1, compat)(var2.compute(), equiv=lazy_array_equiv) is None |
| 1710 | assert ( |
| 1711 | getattr(var1.compute(), compat)(var2.compute(), equiv=lazy_array_equiv) is None |
| 1712 | ) |
| 1713 | |
| 1714 | with raise_if_dask_computes(): |
| 1715 | assert getattr(var1, compat)(var2.transpose("y", "x")) |
| 1716 | |
| 1717 | |
| 1718 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected
searching dependent graphs…