MCPcopy Index your code
hub / github.com/pydata/xarray / test_broadcast_to_errors

Method test_broadcast_to_errors

xarray/tests/test_namedarray.py:581–591  ·  view source on GitHub ↗
(
        self, target: NamedArray[Any, np.dtype[np.float32]]
    )

Source from the content-addressed store, hash-verified

579 assert result.sizes == broadcast_dims
580
581 def test_broadcast_to_errors(
582 self, target: NamedArray[Any, np.dtype[np.float32]]
583 ) -> None:
584 with pytest.raises(
585 ValueError,
586 match=r"operands could not be broadcast together with remapped shapes",
587 ):
588 target.broadcast_to({"x": 2, "y": 2})
589
590 with pytest.raises(ValueError, match=r"Cannot add new dimensions"):
591 target.broadcast_to({"x": 2, "y": 2, "z": 2})
592
593 def test_warn_on_repeated_dimension_names(self) -> None:
594 with pytest.warns(UserWarning, match="Duplicate dimension names"):

Callers

nothing calls this directly

Calls 1

broadcast_toMethod · 0.80

Tested by

no test coverage detected