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

Skip to content

Commit 70dc609

Browse files
Add test_vlines to test_datetime.py
1 parent 41afb90 commit 70dc609

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,24 @@ def test_violinplot(self):
750750
fig, ax = plt.subplots()
751751
ax.violinplot(...)
752752

753-
@pytest.mark.xfail(reason="Test for vlines not written yet")
754753
@mpl.style.context("default")
755754
def test_vlines(self):
756-
fig, ax = plt.subplots()
757-
ax.vlines(...)
755+
mpl.rcParams["date.converter"] = 'concise'
756+
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout='constrained')
757+
ax1.set_xlim(left=datetime.datetime(2023, 1, 1),
758+
right=datetime.datetime(2023, 6, 30))
759+
ax1.vlines(x=[datetime.datetime(2023, 2, 10),
760+
datetime.datetime(2023, 5, 18),
761+
datetime.datetime(2023, 6, 6)],
762+
ymin=[0, 0.25, 0.5],
763+
ymax=[0.25, 0.5, 0.75])
764+
ax2.set_xlim(left=0,
765+
right=0.5)
766+
ax2.vlines(x=[0.3, 0.35],
767+
ymin=[np.datetime64('2023-03-20'), np.datetime64('2023-03-31')],
768+
ymax=[np.datetime64('2023-05-01'), np.datetime64('2023-05-16')])
769+
ax3.set_xlim(left=datetime.datetime(2023, 7, 1),
770+
right=datetime.datetime(2023, 12, 31))
771+
ax3.vlines(x=[datetime.datetime(2023, 9, 1), datetime.datetime(2023, 12, 10)],
772+
ymin=datetime.datetime(2023, 1, 15),
773+
ymax=datetime.datetime(2023, 1, 30))

0 commit comments

Comments
 (0)