(self, keep_attrs, attrs, expected)
| 4776 | ], |
| 4777 | ) |
| 4778 | def test_pad_keep_attrs(self, keep_attrs, attrs, expected) -> None: |
| 4779 | arr = xr.DataArray( |
| 4780 | [1, 2], dims="x", coords={"c": ("x", [-1, 1], attrs)}, attrs=attrs |
| 4781 | ) |
| 4782 | expected = xr.DataArray( |
| 4783 | [0, 1, 2, 0], |
| 4784 | dims="x", |
| 4785 | coords={"c": ("x", [np.nan, -1, 1, np.nan], expected)}, |
| 4786 | attrs=expected, |
| 4787 | ) |
| 4788 | |
| 4789 | keep_attrs_ = "default" if keep_attrs is None else keep_attrs |
| 4790 | |
| 4791 | with set_options(keep_attrs=keep_attrs_): |
| 4792 | actual = arr.pad({"x": (1, 1)}, mode="constant", constant_values=0) |
| 4793 | xr.testing.assert_identical(actual, expected) |
| 4794 | |
| 4795 | actual = arr.pad( |
| 4796 | {"x": (1, 1)}, mode="constant", constant_values=0, keep_attrs=keep_attrs |
| 4797 | ) |
| 4798 | xr.testing.assert_identical(actual, expected) |
| 4799 | |
| 4800 | @pytest.mark.parametrize("parser", ["pandas", "python"]) |
| 4801 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected