def test_labels_with_units_with_interval(self, dim) -> None:
        """Test line plot with intervals and a units attribute."""
        bins = [-1, 0, 1, 2]
        arr = self.darray.groupby_bins("dim_0", bins).mean(...)
        arr.dim_0_bins.attrs["units"] = "m"

        (mappable,) = arr.plot(**{dim: "dim_0_bins"})  # type: ignore[arg-type]
        ax = mappable.figure.gca()
        actual = getattr(ax, f"get_{dim}label")()

        expected = "dim_0_bins_center [m]"
        assert actual == expected
Test line plot with intervals and a units attribute.
xarray/tests/test_plot.py