From 70dc609d4455986a7297b50409a2598d603becf7 Mon Sep 17 00:00:00 2001 From: madisonwong210 Date: Thu, 30 Nov 2023 17:40:29 -0500 Subject: [PATCH] Add test_vlines to test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 61d1623c6bbc..cec2fa891e80 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -750,8 +750,24 @@ def test_violinplot(self): fig, ax = plt.subplots() ax.violinplot(...) - @pytest.mark.xfail(reason="Test for vlines not written yet") @mpl.style.context("default") def test_vlines(self): - fig, ax = plt.subplots() - ax.vlines(...) + mpl.rcParams["date.converter"] = 'concise' + fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout='constrained') + ax1.set_xlim(left=datetime.datetime(2023, 1, 1), + right=datetime.datetime(2023, 6, 30)) + ax1.vlines(x=[datetime.datetime(2023, 2, 10), + datetime.datetime(2023, 5, 18), + datetime.datetime(2023, 6, 6)], + ymin=[0, 0.25, 0.5], + ymax=[0.25, 0.5, 0.75]) + ax2.set_xlim(left=0, + right=0.5) + ax2.vlines(x=[0.3, 0.35], + ymin=[np.datetime64('2023-03-20'), np.datetime64('2023-03-31')], + ymax=[np.datetime64('2023-05-01'), np.datetime64('2023-05-16')]) + ax3.set_xlim(left=datetime.datetime(2023, 7, 1), + right=datetime.datetime(2023, 12, 31)) + ax3.vlines(x=[datetime.datetime(2023, 9, 1), datetime.datetime(2023, 12, 10)], + ymin=datetime.datetime(2023, 1, 15), + ymax=datetime.datetime(2023, 1, 30)) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy