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

Function test_keep_attrs_strategies_variable

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

Source from the content-addressed store, hash-verified

779 ),
780)
781def test_keep_attrs_strategies_variable(strategy, attrs, expected, error) -> None:
782 a = xr.Variable("x", [0, 1], attrs=attrs[0])
783 b = xr.Variable("x", [0, 1], attrs=attrs[1])
784 c = xr.Variable("x", [0, 1], attrs=attrs[2])
785
786 if error:
787 with pytest.raises(xr.MergeError):
788 apply_ufunc(lambda *args: sum(args), a, b, c, keep_attrs=strategy)
789 else:
790 expected = xr.Variable("x", [0, 3], attrs=expected)
791 actual = apply_ufunc(lambda *args: sum(args), a, b, c, keep_attrs=strategy)
792
793 assert_identical(actual, expected)
794
795
796@pytest.mark.parametrize(

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…