Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cad6d11

Browse files
committed
Added test for broken_barh to test_datetime.py
1 parent 5b5154d commit cad6d11

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,18 @@ def test_boxplot(self):
195195
fig, ax = plt.subplots()
196196
ax.boxplot(...)
197197

198-
@pytest.mark.xfail(reason="Test for broken_barh not written yet")
199198
@mpl.style.context("default")
200199
def test_broken_barh(self):
200+
# Horizontal bar plot with gaps
201+
mpl.rcParams["date.converter"] = 'concise'
201202
fig, ax = plt.subplots()
202-
ax.broken_barh(...)
203+
204+
ax.broken_barh([(datetime.datetime(2023, 1, 4), datetime.timedelta(days=2)),
205+
(datetime.datetime(2023, 1, 8), datetime.timedelta(days=3))],
206+
(10, 9), facecolors='tab:blue')
207+
ax.broken_barh([(datetime.datetime(2023, 1, 2), datetime.timedelta(days=1)),
208+
(datetime.datetime(2023, 1, 4), datetime.timedelta(days=4))],
209+
(20, 9), facecolors=('tab:red'))
203210

204211
@pytest.mark.xfail(reason="Test for bxp not written yet")
205212
@mpl.style.context("default")

0 commit comments

Comments
 (0)