MCPcopy
hub / github.com/pydata/xarray / test_labels_with_units_with_interval

Method test_labels_with_units_with_interval

xarray/tests/test_plot.py:734–745  ·  view source on GitHub ↗

Test line plot with intervals and a units attribute.

(self, dim)

Source from the content-addressed store, hash-verified

732
733 @pytest.mark.parametrize("dim", ("x", "y"))
734 def test_labels_with_units_with_interval(self, dim) -> None:
735 """Test line plot with intervals and a units attribute."""
736 bins = [-1, 0, 1, 2]
737 arr = self.darray.groupby_bins("dim_0", bins).mean(...)
738 arr.dim_0_bins.attrs["units"] = "m"
739
740 (mappable,) = arr.plot(**{dim: "dim_0_bins"}) # type: ignore[arg-type]
741 ax = mappable.figure.gca()
742 actual = getattr(ax, f"get_{dim}label")()
743
744 expected = "dim_0_bins_center [m]"
745 assert actual == expected
746
747 def test_multiplot_over_length_one_dim(self) -> None:
748 a = easy_array((3, 1, 1, 1))

Callers

nothing calls this directly

Calls 3

plotMethod · 0.80
meanMethod · 0.45
groupby_binsMethod · 0.45

Tested by

no test coverage detected