Skip to content

Commit c563085

Browse files
committed
Add test_barh in test_datetime.py
1 parent caa750e commit c563085

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,18 @@ def test_barbs(self):
8080
fig, ax = plt.subplots()
8181
ax.barbs(...)
8282

83-
@pytest.mark.xfail(reason="Test for barh not written yet")
8483
@mpl.style.context("default")
8584
def test_barh(self):
86-
fig, ax = plt.subplots()
87-
ax.barh(...)
85+
mpl.rcParams["date.converter"] = 'concise'
86+
N = 14
87+
base = datetime.datetime(1970, 1, 1)
88+
indices = np.arange(N)
89+
dates = [base + datetime.timedelta(days=(7 * i)) for i in range(N)]
90+
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout='constrained')
91+
error = np.random.rand(N)
92+
ax1.barh(indices, dates, xerr=error)
93+
ax2.barh(dates, indices)
94+
ax3.barh(dates, dates)
8895

8996
@pytest.mark.xfail(reason="Test for boxplot not written yet")
9097
@mpl.style.context("default")

0 commit comments

Comments
 (0)