From 04347743c7a2850ca85da0259ec92e78fa3bb9e4 Mon Sep 17 00:00:00 2001 From: Koustav Ghosh Date: Sun, 8 Oct 2023 19:29:54 +0530 Subject: [PATCH 1/5] Add test_bar in test_datetime --- lib/matplotlib/tests/test_datetime.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 53958229f174..2566baad27d1 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -62,11 +62,24 @@ def test_axvspan(self): fig, ax = plt.subplots() ax.axvspan(...) - @pytest.mark.xfail(reason="Test for bar not written yet") @mpl.style.context("default") def test_bar(self): - fig, ax = plt.subplots() - ax.bar(...) + mpl.rcParams["date.converter"] = "concise" + range_threshold = 10 + fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") + + x_dates = np.array( + [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] + ) + y_dates = np.array( + [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] + ) + x_ranges = np.array(range(1, range_threshold)) + y_ranges = np.array(range(1, range_threshold)) + + ax1.bar(x_dates, y_ranges) + ax2.bar(x_dates, y_dates) + ax3.bar(x_ranges, y_dates) @pytest.mark.xfail(reason="Test for bar_label not written yet") @mpl.style.context("default") From 34026319c0501d53bfc00f216e05a496058a269e Mon Sep 17 00:00:00 2001 From: Koustav Ghosh Date: Sat, 14 Oct 2023 23:52:24 +0530 Subject: [PATCH 2/5] raising revision for test_bar in test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index bea744cb435d..deaef36fef51 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -60,20 +60,23 @@ def test_axvspan(self): def test_bar(self): mpl.rcParams["date.converter"] = "concise" range_threshold = 10 - fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") + fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, layout="constrained") x_dates = np.array( - [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] + [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)], + dtype=np.datetime64, ) y_dates = np.array( - [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] + [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)], + dtype=np.datetime64, ) x_ranges = np.array(range(1, range_threshold)) y_ranges = np.array(range(1, range_threshold)) - ax1.bar(x_dates, y_ranges) - ax2.bar(x_dates, y_dates) - ax3.bar(x_ranges, y_dates) + ax1.bar(x_dates, y_ranges, width=np.timedelta64(range_threshold, "D")) + ax2.bar(x_dates, y_dates, width=np.timedelta64(range_threshold, "D")) + ax3.bar(x_ranges, y_dates, width=np.timedelta64(range_threshold, "D")) + ax4.bar(x_ranges, y_ranges, bottom=datetime.datetime(2023, 10, 1)) @pytest.mark.xfail(reason="Test for bar_label not written yet") @mpl.style.context("default") From fd16b352b1e16673bd7b2aae3a1e9ae8d6bcc3cf Mon Sep 17 00:00:00 2001 From: Koustav Ghosh Date: Sat, 21 Oct 2023 18:57:39 +0530 Subject: [PATCH 3/5] raising revision for test_bar in test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 69ff5d37c0d0..2ec3d03ae377 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -90,24 +90,23 @@ def test_axvspan(self): @mpl.style.context("default") def test_bar(self): mpl.rcParams["date.converter"] = "concise" - range_threshold = 10 - fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, layout="constrained") + + fig, (ax1, ax2) = plt.subplots(2, 1, layout="constrained") x_dates = np.array( - [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)], + [ + datetime(2020, 6, 30), + datetime(2020, 7, 22), + datetime(2020, 8, 3), + datetime(2020, 9, 14), + ], dtype=np.datetime64, ) - y_dates = np.array( - [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)], - dtype=np.datetime64, - ) - x_ranges = np.array(range(1, range_threshold)) - y_ranges = np.array(range(1, range_threshold)) + x_ranges = [8800, 2600, 8500, 7400] - ax1.bar(x_dates, y_ranges, width=np.timedelta64(range_threshold, "D")) - ax2.bar(x_dates, y_dates, width=np.timedelta64(range_threshold, "D")) - ax3.bar(x_ranges, y_dates, width=np.timedelta64(range_threshold, "D")) - ax4.bar(x_ranges, y_ranges, bottom=datetime.datetime(2023, 10, 1)) + x = np.datetime64(datetime(2020, 6, 1)) + ax1.bar(x_dates, x_ranges, width=np.timedelta64(4, "D")) + ax2.bar(np.arange(4), x_dates, bottom=x) @pytest.mark.xfail(reason="Test for bar_label not written yet") @mpl.style.context("default") From 86b12d3c8ccb840384cd53d49b1cf4d5ba6fcb84 Mon Sep 17 00:00:00 2001 From: Koustav Ghosh Date: Sat, 21 Oct 2023 21:37:40 +0530 Subject: [PATCH 4/5] Update test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 2ec3d03ae377..30645f7ec1aa 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -95,16 +95,16 @@ def test_bar(self): x_dates = np.array( [ - datetime(2020, 6, 30), - datetime(2020, 7, 22), - datetime(2020, 8, 3), - datetime(2020, 9, 14), + datetime.datetime(2020, 6, 30), + datetime.datetime(2020, 7, 22), + datetime.datetime(2020, 8, 3), + datetime.datetime(2020, 9, 14), ], dtype=np.datetime64, ) x_ranges = [8800, 2600, 8500, 7400] - x = np.datetime64(datetime(2020, 6, 1)) + x = np.datetime64(datetime.datetime(2020, 6, 1)) ax1.bar(x_dates, x_ranges, width=np.timedelta64(4, "D")) ax2.bar(np.arange(4), x_dates, bottom=x) From e27da804a4779752f2aee9d3e9b8ff4f1519420f Mon Sep 17 00:00:00 2001 From: Koustav Ghosh Date: Wed, 25 Oct 2023 00:09:29 +0530 Subject: [PATCH 5/5] Revising test_bar in test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 30645f7ec1aa..6aca1bc6eb4c 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -106,7 +106,7 @@ def test_bar(self): x = np.datetime64(datetime.datetime(2020, 6, 1)) ax1.bar(x_dates, x_ranges, width=np.timedelta64(4, "D")) - ax2.bar(np.arange(4), x_dates, bottom=x) + ax2.bar(np.arange(4), x_dates - x, bottom=x) @pytest.mark.xfail(reason="Test for bar_label 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