(self)
| 3577 | assert_identical(expected_y2, y2) |
| 3578 | |
| 3579 | def test_broadcast_arrays_nocopy(self) -> None: |
| 3580 | # Test that input data is not copied over in case |
| 3581 | # no alteration is needed |
| 3582 | x = DataArray([1, 2], coords=[("a", [-1, -2])], name="x") |
| 3583 | y = DataArray(3, name="y") |
| 3584 | expected_x2 = DataArray([1, 2], coords=[("a", [-1, -2])], name="x") |
| 3585 | expected_y2 = DataArray([3, 3], coords=[("a", [-1, -2])], name="y") |
| 3586 | |
| 3587 | x2, y2 = broadcast(x, y) |
| 3588 | assert_identical(expected_x2, x2) |
| 3589 | assert_identical(expected_y2, y2) |
| 3590 | assert source_ndarray(x2.data) is source_ndarray(x.data) |
| 3591 | |
| 3592 | # single-element broadcast (trivial case) |
| 3593 | (x2,) = broadcast(x) |
| 3594 | assert_identical(x, x2) |
| 3595 | assert source_ndarray(x2.data) is source_ndarray(x.data) |
| 3596 | |
| 3597 | def test_broadcast_arrays_exclude(self) -> None: |
| 3598 | x = DataArray([[1, 2], [3, 4]], coords=[("a", [-1, -2]), ("b", [3, 4])]) |
nothing calls this directly
no test coverage detected