(strategy, attrs, expected, error)
| 848 | ), |
| 849 | ) |
| 850 | def 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")) |
nothing calls this directly
no test coverage detected
searching dependent graphs…