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

Function test_keep_attrs_strategies_dataarray

xarray/tests/test_computation.py:850–862  ·  view source on GitHub ↗
(strategy, attrs, expected, error)

Source from the content-addressed store, hash-verified

848 ),
849)
850def test_keep_attrs_strategies_dataarray(strategy, attrs, expected, error) -> None:
851 a = xr.DataArray(dims="x", data=[0, 1], attrs=attrs[0])
852 b = xr.DataArray(dims="x", data=[0, 1], attrs=attrs[1])
853 c = xr.DataArray(dims="x", data=[0, 1], attrs=attrs[2])
854
855 if error:
856 with pytest.raises(xr.MergeError):
857 apply_ufunc(lambda *args: sum(args), a, b, c, keep_attrs=strategy)
858 else:
859 expected = xr.DataArray(dims="x", data=[0, 3], attrs=expected)
860 actual = apply_ufunc(lambda *args: sum(args), a, b, c, keep_attrs=strategy)
861
862 assert_identical(actual, expected)
863
864
865@pytest.mark.parametrize("variant", ("dim", "coord"))

Callers

nothing calls this directly

Calls 2

apply_ufuncFunction · 0.90
assert_identicalFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…