Skip to content

Commit 0081cfb

Browse files
committed
Add test for interval on both axes
1 parent 841e5f5 commit 0081cfb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

xarray/tests/test_plot.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,15 @@ def test_coord_with_interval_step_y(self):
832832
self.darray.groupby_bins("dim_0", bins).mean(...).plot.step(y="dim_0_bins")
833833
assert len(plt.gca().lines[0].get_xdata()) == ((len(bins) - 1) * 2)
834834

835+
def test_coord_with_interval_step_x_and_y_raises_valueeerror(self):
836+
"""Test that step plot with intervals both on x and y axes raises an error."""
837+
arr = xr.DataArray(
838+
[pd.Interval(0, 1), pd.Interval(1, 2)],
839+
coords=[("x", [pd.Interval(0, 1), pd.Interval(1, 2)])],
840+
)
841+
with pytest.raises(TypeError, match="intervals against intervals"):
842+
arr.plot.step()
843+
835844

836845
class TestPlotHistogram(PlotTestCase):
837846
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)