8000 Merge pull request #27177 from CozyFrog/tst/dt-unit-test · matplotlib/matplotlib@775fbc0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 775fbc0

Browse files
authored
Merge pull request #27177 from CozyFrog/tst/dt-unit-test
Add test_axhline in test_datetime.py
2 parents 309981d + f319e35 commit 775fbc0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,19 @@ 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):
32-
fig, ax = plt.subplots()
33-
ax.axhline(...)
31+
mpl.rcParams["date.converter"] = 'concise'
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)
41+
ax3.axhline(y=datetime.datetime(2023, 10, 24), xmin=0.4, xmax=0.7)
3442

3543
@mpl.style.context("default")
3644
def test_axhspan(self):

0 commit comments

Comments
 (0)
0