()
| 636 | |
| 637 | @pytest.mark.filterwarnings("ignore:Duplicate dimension names present") |
| 638 | def test_unified_dim_sizes() -> None: |
| 639 | assert unified_dim_sizes([xr.Variable((), 0)]) == {} |
| 640 | assert unified_dim_sizes([xr.Variable("x", [1]), xr.Variable("x", [1])]) == {"x": 1} |
| 641 | assert unified_dim_sizes([xr.Variable("x", [1]), xr.Variable("y", [1, 2])]) == { |
| 642 | "x": 1, |
| 643 | "y": 2, |
| 644 | } |
| 645 | assert unified_dim_sizes( |
| 646 | [xr.Variable(("x", "z"), [[1]]), xr.Variable(("y", "z"), [[1, 2], [3, 4]])], |
| 647 | exclude_dims={"z"}, |
| 648 | ) == {"x": 1, "y": 2} |
| 649 | |
| 650 | with pytest.raises(ValueError, match="broadcasting cannot handle"): |
| 651 | with pytest.warns(UserWarning, match="Duplicate dimension names"): |
| 652 | unified_dim_sizes([xr.Variable(("x", "x"), [[1]])]) |
| 653 | |
| 654 | # mismatched lengths |
| 655 | with pytest.raises(ValueError): |
| 656 | unified_dim_sizes([xr.Variable("x", [1]), xr.Variable("x", [1, 2])]) |
| 657 | |
| 658 | |
| 659 | def test_broadcast_compat_data_1d() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…