From cad6d112f59663a03c51a2b9db2ca21ea91d0ae3 Mon Sep 17 00:00:00 2001 From: avramid9 <97982258+avramid9@users.noreply.github.com> Date: Sun, 3 Dec 2023 16:55:59 +0000 Subject: [PATCH] Added test for broken_barh to test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index ca8e1cb90732..1af08ebee724 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -195,11 +195,18 @@ def test_boxplot(self): fig, ax = plt.subplots() ax.boxplot(...) - @pytest.mark.xfail(reason="Test for broken_barh not written yet") @mpl.style.context("default") def test_broken_barh(self): + # Horizontal bar plot with gaps + mpl.rcParams["date.converter"] = 'concise' fig, ax = plt.subplots() - ax.broken_barh(...) + + ax.broken_barh([(datetime.datetime(2023, 1, 4), datetime.timedelta(days=2)), + (datetime.datetime(2023, 1, 8), datetime.timedelta(days=3))], + (10, 9), facecolors='tab:blue') + ax.broken_barh([(datetime.datetime(2023, 1, 2), datetime.timedelta(days=1)), + (datetime.datetime(2023, 1, 4), datetime.timedelta(days=4))], + (20, 9), facecolors=('tab:red')) @pytest.mark.xfail(reason="Test for bxp not written yet") @mpl.style.context("default")