(self, fill_value)
| 1876 | |
| 1877 | @pytest.mark.parametrize("fill_value", [dtypes.NA, 2, 2.0, {None: 2, "u": 1}]) |
| 1878 | def test_reindex_fill_value(self, fill_value) -> None: |
| 1879 | x = DataArray([10, 20], dims="y", coords={"y": [0, 1], "u": ("y", [1, 2])}) |
| 1880 | y = [0, 1, 2] |
| 1881 | if fill_value == dtypes.NA: |
| 1882 | # if we supply the default, we expect the missing value for a |
| 1883 | # float array |
| 1884 | fill_value_var = fill_value_u = np.nan |
| 1885 | elif isinstance(fill_value, dict): |
| 1886 | fill_value_var = fill_value[None] |
| 1887 | fill_value_u = fill_value["u"] |
| 1888 | else: |
| 1889 | fill_value_var = fill_value_u = fill_value |
| 1890 | actual = x.reindex(y=y, fill_value=fill_value) |
| 1891 | expected = DataArray( |
| 1892 | [10, 20, fill_value_var], |
| 1893 | dims="y", |
| 1894 | coords={"y": y, "u": ("y", [1, 2, fill_value_u])}, |
| 1895 | ) |
| 1896 | assert_identical(expected, actual) |
| 1897 | |
| 1898 | @pytest.mark.parametrize("dtype", [str, bytes]) |
| 1899 | def test_reindex_str_dtype(self, dtype) -> None: |
nothing calls this directly
no test coverage detected