From 3783494358d15a35fe63e9607a84cf1d57cbd18f Mon Sep 17 00:00:00 2001 From: Junpei Ota Date: Thu, 19 Oct 2023 02:19:32 -0400 Subject: [PATCH] Added smoke test for Axes.text --- lib/matplotlib/tests/test_datetime.py | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index f42e0a0d04d8..5d9ca3bb8f18 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -355,11 +355,33 @@ def test_streamplot(self): fig, ax = plt.subplots() ax.streamplot(...) - @pytest.mark.xfail(reason="Test for text not written yet") @mpl.style.context("default") def test_text(self): - fig, ax = plt.subplots() - ax.text(...) + mpl.rcParams["date.converter"] = 'concise' + fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") + + limit_value = 10 + font_properties = {'family': 'serif', 'size': 12, 'weight': 'bold'} + test_date = datetime.datetime(2023, 10, 1) + + x_data = np.array(range(1, limit_value)) + y_data = np.array(range(1, limit_value)) + + x_dates = np.array( + [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] + ) + y_dates = np.array( + [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] + ) + + ax1.plot(x_dates, y_data) + ax1.text(test_date, 5, "Inserted Text", **font_properties) + + ax2.plot(x_data, y_dates) + ax2.text(7, test_date, "Inserted Text", **font_properties) + + ax3.plot(x_dates, y_dates) + ax3.text(test_date, test_date, "Inserted Text", **font_properties) @pytest.mark.xfail(reason="Test for tricontour not written yet") @mpl.style.context("default") 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