Skip to content

Commit 875b441

Browse files
committed
Add test_axhline in test_datetime.py
1 parent 0c2f104 commit 875b441

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ def test_arrow(self):
2626
fig, ax = plt.subplots()
2727
ax.arrow(...)
2828

29-
@pytest.mark.xfail(reason="Test for axhline not written yet")
3029
@mpl.style.context("default")
3130
def test_axhline(self):
3231
mpl.rcParams["date.converter"] = 'concise'
33-
fig, ax = plt.subplots(layout='constrained')
34-
ax.axhline(y=datetime.datetime(2020, 6, 1), xmin=0.2, xmax=0.8)
32+
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout='constrained')
33+
ax1.set_ylim(bottom=datetime.datetime(2020, 4, 1),
34+
top=datetime.datetime(2020, 8, 1))
35+
ax2.set_ylim(bottom=np.datetime64('2005-01-01'),
36+
top=np.datetime64('2005-04-01'))
37+
ax3.set_ylim(bottom=datetime.datetime(2023, 9, 1),
38+
top=datetime.datetime(2023, 11, 1))
39+
ax1.axhline(y=datetime.datetime(2020, 6, 3), xmin=0.5, xmax=0.7)
40+
ax2.axhline(np.datetime64('2005-02-25T03:30'), xmin=0.1, xmax=0.9)
3541

3642
@pytest.mark.xfail(reason="Test for axhspan not written yet")
3743
@mpl.style.context("default")

0 commit comments

Comments
 (0)