From c85826f85cec40138f4b0f9f7e0eb927a7133c94 Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Wed, 20 Dec 2023 18:50:26 +0800 Subject: [PATCH 01/10] update test_datetime --- lib/matplotlib/tests/test_datetime.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 83f1aee4f8bb..f26bc078aa9f 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -464,11 +464,23 @@ def test_plot_date(self): ax2.plot_date(x_dates, y_ranges) ax3.plot_date(x_ranges, y_dates) - @pytest.mark.xfail(reason="Test for quiver not written yet") @mpl.style.context("default") def test_quiver(self): - fig, ax = plt.subplots() - ax.quiver(...) + range_threshold = 10 + fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") + + x_dates = [datetime.datetime(2023, 11, 1) + datetime.timedelta(days=i) for i in range(range_threshold)] + + y_dates = [datetime.datetime(2023, 12, 1) + datetime.timedelta(days=i) for i in range(range_threshold)] + x_ranges = np.array(range(range_threshold)) + y_ranges = np.array(range(range_threshold)) + + U = np.sin(np.arange(len(x_dates))) + V = np.cos(np.arange(len(y_dates))) + + ax1.quiver(x_dates, y_ranges, U, V, scale=20) + ax2.quiver(x_ranges, y_dates, U, V, scale=20) + ax3.quiver(x_dates, y_dates, U, V, scale=20) @pytest.mark.xfail(reason="Test for quiverkey not written yet") @mpl.style.context("default") From 58ecf035c22e6963dabe2dc5cd58a641db7eae57 Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Wed, 20 Dec 2023 19:49:23 +0800 Subject: [PATCH 02/10] update test_datetime --- lib/matplotlib/tests/test_datetime.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index f26bc078aa9f..4f522c2daddb 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -469,9 +469,11 @@ def test_quiver(self): range_threshold = 10 fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") - x_dates = [datetime.datetime(2023, 11, 1) + datetime.timedelta(days=i) for i in range(range_threshold)] + x_dates = [datetime.datetime(2023, 11, 1) + datetime.timedelta(days=i) + for i in range(range_threshold)] - y_dates = [datetime.datetime(2023, 12, 1) + datetime.timedelta(days=i) for i in range(range_threshold)] + y_dates = [datetime.datetime(2023, 12, 1) + datetime.timedelta(days=i) + for i in range(range_threshold)] x_ranges = np.array(range(range_threshold)) y_ranges = np.array(range(range_threshold)) From 326ae5d9392949114cb566e9c45e4e53f655db29 Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Wed, 20 Dec 2023 20:03:45 +0800 Subject: [PATCH 03/10] update test_datetime --- lib/matplotlib/tests/test_datetime.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 4f522c2daddb..30ed261a3606 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -466,16 +466,19 @@ def test_plot_date(self): @mpl.style.context("default") def test_quiver(self): - range_threshold = 10 + threshold = 10 fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") - x_dates = [datetime.datetime(2023, 11, 1) + datetime.timedelta(days=i) - for i in range(range_threshold)] - - y_dates = [datetime.datetime(2023, 12, 1) + datetime.timedelta(days=i) - for i in range(range_threshold)] - x_ranges = np.array(range(range_threshold)) - y_ranges = np.array(range(range_threshold)) + x_dates = np.array( + [datetime.datetime(2023, 11, 1+delta) for delta in range(threshold)] + ) + y_dates = np.array( + [datetime.datetime(2023, 12, 1+delta) for delta in range(threshold)] + ) + x_ranges = np.array(range(threshold)) + y_ranges = np.array(range(threshold)) + x_ranges = np.array(range(threshold)) + y_ranges = np.array(range(threshold)) U = np.sin(np.arange(len(x_dates))) V = np.cos(np.arange(len(y_dates))) From 5ee96e4c27e3deef55e7f069d2fe2e4176509508 Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Tue, 23 Jan 2024 19:40:36 +0800 Subject: [PATCH 04/10] remove duplicate code --- lib/matplotlib/tests/test_datetime.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 30ed261a3606..80865ff4f5c0 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -477,8 +477,6 @@ def test_quiver(self): ) x_ranges = np.array(range(threshold)) y_ranges = np.array(range(threshold)) - x_ranges = np.array(range(threshold)) - y_ranges = np.array(range(threshold)) U = np.sin(np.arange(len(x_dates))) V = np.cos(np.arange(len(y_dates))) From 4f1dcb8e97ef4a55944c98e6292cd0c0b39d7ba6 Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Tue, 23 Jan 2024 20:25:07 +0800 Subject: [PATCH 05/10] remove duplicate code --- lib/matplotlib/tests/test_datetime.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 102f1e97df49..553017052e21 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -667,11 +667,12 @@ def test_quiver(self): fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") x_dates = np.array( - [datetime.datetime(2023, 11, 1+delta) for delta in range(threshold)] + [datetime.datetime(2024, 1, 1+delta) for delta in range(threshold)] ) y_dates = np.array( - [datetime.datetime(2023, 12, 1+delta) for delta in range(threshold)] + [datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)] ) + x_ranges = np.array(range(threshold)) y_ranges = np.array(range(threshold)) From ef71ef5449f8cc8f676516b27a84b00fa03d9270 Mon Sep 17 00:00:00 2001 From: Elllllllvin <100711005+Elllllllvin@users.noreply.github.com> Date: Tue, 23 Jan 2024 20:28:49 +0800 Subject: [PATCH 06/10] Update lib/matplotlib/tests/test_datetime.py Co-authored-by: David Stansby --- lib/matplotlib/tests/test_datetime.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 553017052e21..923c79ae650f 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -673,8 +673,6 @@ def test_quiver(self): [datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)] ) - x_ranges = np.array(range(threshold)) - y_ranges = np.array(range(threshold)) U = np.sin(np.arange(len(x_dates))) V = np.cos(np.arange(len(y_dates))) From b5f40808dbdd3f6a9da9be4795157580fc51cd00 Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Tue, 23 Jan 2024 20:41:53 +0800 Subject: [PATCH 07/10] update --- lib/matplotlib/tests/test_datetime.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 923c79ae650f..533072dd071e 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -672,7 +672,8 @@ def test_quiver(self): y_dates = np.array( [datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)] ) - + x_ranges = np.array(range(threshold)) + y_ranges = np.array(range(threshold)) U = np.sin(np.arange(len(x_dates))) V = np.cos(np.arange(len(y_dates))) From db32e400789b7eca2f4c0ec728b5f902eb3bcbeb Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Tue, 23 Jan 2024 21:02:01 +0800 Subject: [PATCH 08/10] update --- lib/matplotlib/tests/test_datetime.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 533072dd071e..553017052e21 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -672,6 +672,7 @@ def test_quiver(self): y_dates = np.array( [datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)] ) + x_ranges = np.array(range(threshold)) y_ranges = np.array(range(threshold)) From 1f2684b41098b75f3f84e69e303d35734d5e32d1 Mon Sep 17 00:00:00 2001 From: Elllllllvin <978499686@qq.com> Date: Tue, 23 Jan 2024 21:06:11 +0800 Subject: [PATCH 09/10] update --- lib/matplotlib/tests/test_datetime.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 553017052e21..533072dd071e 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -672,7 +672,6 @@ def test_quiver(self): y_dates = np.array( [datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)] ) - x_ranges = np.array(range(threshold)) y_ranges = np.array(range(threshold)) From 10998f580047f39d0ec06d174131c8dbbed8d533 Mon Sep 17 00:00:00 2001 From: Elllllllvin <100711005+Elllllllvin@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:16:48 +0800 Subject: [PATCH 10/10] Update lib/matplotlib/tests/test_datetime.py Co-authored-by: Elliott Sales de Andrade --- lib/matplotlib/tests/test_datetime.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 533072dd071e..f19937149563 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -667,13 +667,13 @@ def test_quiver(self): fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") x_dates = np.array( - [datetime.datetime(2024, 1, 1+delta) for delta in range(threshold)] - ) + [datetime.datetime(2024, 1, 1+delta) for delta in range(threshold)] + ) y_dates = np.array( - [datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)] - ) - x_ranges = np.array(range(threshold)) - y_ranges = np.array(range(threshold)) + [datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)] + ) + x_ranges = np.arange(threshold) + y_ranges = np.arange(threshold) U = np.sin(np.arange(len(x_dates))) V = np.cos(np.arange(len(y_dates)))