(self, fill_value)
| 2527 | |
| 2528 | @pytest.mark.parametrize("fill_value", [dtypes.NA, 2, 2.0, {"foo": 2, "bar": 1}]) |
| 2529 | def test_align_fill_value(self, fill_value) -> None: |
| 2530 | x = Dataset({"foo": DataArray([1, 2], dims=["x"], coords={"x": [1, 2]})}) |
| 2531 | y = Dataset({"bar": DataArray([1, 2], dims=["x"], coords={"x": [1, 3]})}) |
| 2532 | x2, y2 = align(x, y, join="outer", fill_value=fill_value) |
| 2533 | if fill_value == dtypes.NA: |
| 2534 | # if we supply the default, we expect the missing value for a |
| 2535 | # float array |
| 2536 | fill_value_foo = fill_value_bar = np.nan |
| 2537 | elif isinstance(fill_value, dict): |
| 2538 | fill_value_foo = fill_value["foo"] |
| 2539 | fill_value_bar = fill_value["bar"] |
| 2540 | else: |
| 2541 | fill_value_foo = fill_value_bar = fill_value |
| 2542 | |
| 2543 | expected_x2 = Dataset( |
| 2544 | { |
| 2545 | "foo": DataArray( |
| 2546 | [1, 2, fill_value_foo], dims=["x"], coords={"x": [1, 2, 3]} |
| 2547 | ) |
| 2548 | } |
| 2549 | ) |
| 2550 | expected_y2 = Dataset( |
| 2551 | { |
| 2552 | "bar": DataArray( |
| 2553 | [1, fill_value_bar, 2], dims=["x"], coords={"x": [1, 2, 3]} |
| 2554 | ) |
| 2555 | } |
| 2556 | ) |
| 2557 | assert_identical(expected_x2, x2) |
| 2558 | assert_identical(expected_y2, y2) |
| 2559 | |
| 2560 | def test_align(self) -> None: |
| 2561 | left = create_test_data() |
nothing calls this directly
no test coverage detected