From 6bdea275d4b4760fcfdeaaf10797db70db6dc470 Mon Sep 17 00:00:00 2001 From: jhimanish <54194957+jhimanish@users.noreply.github.com> Date: Sun, 10 Dec 2023 00:49:13 +0000 Subject: [PATCH] Adding datetime test for axes.streamplot --- lib/matplotlib/tests/test_datetime.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 3c8cc8b5b8bb..e5b362e9ee3f 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -694,11 +694,23 @@ def test_step(self): ax2.step(range(1, N), x) ax3.step(x, x) - @pytest.mark.xfail(reason="Test for streamplot not written yet") @mpl.style.context("default") def test_streamplot(self): + mpl.rcParams["date.converter"] = "concise" fig, ax = plt.subplots() - ax.streamplot(...) + + np.random.seed(19680801) + limit_value = 30 + + date_array = np.array( + [datetime.datetime(2023, 12, n) for n in range(1, limit_value)] + ) + date_array_converted = mpl.dates.date2num(date_array) + X, Y = np.meshgrid(date_array_converted, np.arange(0, limit_value-1)) + U = np.random.rand(limit_value-1, limit_value-1) + V = np.random.rand(limit_value-1, limit_value-1) + + ax.streamplot(X, Y, U, V) @mpl.style.context("default") def test_text(self):