Skip to content

Commit d97c8a9

Browse files
committed
Add test_axvline to test_datetime.py
1 parent a589856 commit d97c8a9

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
@@ -44,11 +44,19 @@ def test_axline(self):
4444
fig, ax = plt.subplots()
4545
ax.axline(...)
4646

47-
@pytest.mark.xfail(reason="Test for axvline not written yet")
4847
@mpl.style.context("default")
4948
def test_axvline(self):
50-
fig, ax = plt.subplots()
51-
ax.axvline(...)
49+
mpl.rcParams["date.converter"] = 'concise'
50+
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout='constrained')
51+
ax1.set_xlim(left=datetime.datetime(2020, 4, 1),
52+
right=datetime.datetime(2020, 8, 1))
53+
ax2.set_xlim(left=np.datetime64('2005-01-01'),
54+
right=np.datetime64('2005-04-01'))
55+
ax3.set_xlim(left=datetime.datetime(2023, 9, 1),
56+
right=datetime.datetime(2023, 11, 1))
57+
ax1.axvline(x=datetime.datetime(2020, 6, 3), ymin=0.5, ymax=0.7)
58+
ax2.axvline(np.datetime64('2005-02-25T03:30'), ymin=0.1, ymax=0.9)
59+
ax3.axvline(x=datetime.datetime(2023, 10, 24), ymin=0.4, ymax=0.7)
5260

5361
@pytest.mark.xfail(reason="Test for axvspan not written yet")
5462
@mpl.style.context("default")

0 commit comments

Comments
 (0)