(self, fill_value)
| 6898 | |
| 6899 | @pytest.mark.parametrize("fill_value", [dtypes.NA, 2, 2.0, {"foo": -10}]) |
| 6900 | def test_shift(self, fill_value) -> None: |
| 6901 | coords = {"bar": ("x", list("abc")), "x": [-4, 3, 2]} |
| 6902 | attrs = {"meta": "data"} |
| 6903 | ds = Dataset({"foo": ("x", [1, 2, 3])}, coords, attrs) |
| 6904 | actual = ds.shift(x=1, fill_value=fill_value) |
| 6905 | if fill_value == dtypes.NA: |
| 6906 | # if we supply the default, we expect the missing value for a |
| 6907 | # float array |
| 6908 | fill_value = np.nan |
| 6909 | elif isinstance(fill_value, dict): |
| 6910 | fill_value = fill_value.get("foo", np.nan) |
| 6911 | expected = Dataset({"foo": ("x", [fill_value, 1, 2])}, coords, attrs) |
| 6912 | assert_identical(expected, actual) |
| 6913 | |
| 6914 | with pytest.raises(ValueError, match=r"dimensions"): |
| 6915 | ds.shift(foo=123) |
| 6916 | |
| 6917 | def test_roll_coords(self) -> None: |
| 6918 | coords = {"bar": ("x", list("abc")), "x": [-4, 3, 2]} |
nothing calls this directly
no test coverage detected