From 28e773082952053d47c414abef15cd1bcf916348 Mon Sep 17 00:00:00 2001 From: Tanvi Pooranmal Meena <96572616+TanviPooranmal@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:51:02 +0530 Subject: [PATCH 1/5] Remove axes.violinplot test from test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 104a649e1464..8f65ffb6d310 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -835,12 +835,6 @@ def test_violin(self): fig, ax = plt.subplots() ax.violin(...) - @pytest.mark.xfail(reason="Test for violinplot not written yet") - @mpl.style.context("default") - def test_violinplot(self): - fig, ax = plt.subplots() - ax.violinplot(...) - @mpl.style.context("default") def test_vlines(self): mpl.rcParams["date.converter"] = 'concise' From 002f792eb67cc6e8da8582f7f8a3d24abc67e4e7 Mon Sep 17 00:00:00 2001 From: Tanvi Pooranmal Meena <96572616+TanviPooranmal@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:01:52 +0530 Subject: [PATCH 2/5] Add axes.violinplot test in test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 8f65ffb6d310..7cb3eaa07e2a 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -835,6 +835,32 @@ def test_violin(self): fig, ax = plt.subplots() ax.violin(...) + @pytest.mark.xfail(reason="Test for violinplot not written yet") + @mpl.style.context("default") + def test_violinplot(self): + np.random.seed(19680801) + n_samples = 100 + values = np.random.randn(n_samples) + fig, ax = plt.subplots() + result = ax.violinplot(values, positions=[datetime(2023, 1, 10)], widths=[ + timedelta(days=10)], showmeans=True, showextrema=True) + result1 = ax.violinplot(values, positions=[datetime(2023, 1, 15)], widths=[ + timedelta(days=6)], showmeans=True, showextrema=True) + result2 = ax.violinplot(values, positions=[datetime(2023, 1, 25)], widths=[ + timedelta(days=12)], showmeans=True, showextrema=True) + result3 = ax.violinplot(values, positions=[datetime(2023, 2, 5)], widths=[ + timedelta(days=8)], showmeans=True, showextrema=True) + ax.set_title( + 'Violin Plot with DateTime Positions and Timedelta Widths') + ax.set_xlabel('Dates') + ax.set_ylabel('Values') + plt.xticks(rotation=90) + assert isinstance(result, dict) + assert isinstance(result1, dict) + assert isinstance(result2, dict) + assert isinstance(result3, dict) + assert result is not None, "Failed to create violin plot" + @mpl.style.context("default") def test_vlines(self): mpl.rcParams["date.converter"] = 'concise' From 0ac52c8e7daf93fc7c9b84f19794159fdb37d837 Mon Sep 17 00:00:00 2001 From: Tanvi Pooranmal Meena <96572616+TanviPooranmal@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:06:09 +0530 Subject: [PATCH 3/5] Reviewed failed github tests --- 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 7cb3eaa07e2a..c4f208e5b4bc 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -1,4 +1,5 @@ import datetime +from datetime import timedelta import numpy as np import pytest From a5cb8ef3a3d7d0c1920b6963d6985036cf715ef1 Mon Sep 17 00:00:00 2001 From: Tanvi Pooranmal Meena <96572616+TanviPooranmal@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:09:34 +0530 Subject: [PATCH 4/5] Review failed GitHub actions tests --- 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 c4f208e5b4bc..2621371892c0 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -861,7 +861,7 @@ def test_violinplot(self): assert isinstance(result2, dict) assert isinstance(result3, dict) assert result is not None, "Failed to create violin plot" - + @mpl.style.context("default") def test_vlines(self): mpl.rcParams["date.converter"] = 'concise' From 73ca5cd5eb256cf1665964062a83bddcbe651c74 Mon Sep 17 00:00:00 2001 From: Tanvi Pooranmal Meena <96572616+TanviPooranmal@users.noreply.github.com> Date: Thu, 21 Dec 2023 00:40:31 +0530 Subject: [PATCH 5/5] Review failed codecov test --- lib/matplotlib/tests/test_datetime.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 2621371892c0..d8daeeddb7da 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -845,21 +845,29 @@ def test_violinplot(self): fig, ax = plt.subplots() result = ax.violinplot(values, positions=[datetime(2023, 1, 10)], widths=[ timedelta(days=10)], showmeans=True, showextrema=True) + assert isinstance(result, dict), "Failed to create violin plot" + assert 'bodies' in result, "Violin plot bodies are missing" + assert len(result['bodies']) > 0, "Violin plot bodies are empty" result1 = ax.violinplot(values, positions=[datetime(2023, 1, 15)], widths=[ timedelta(days=6)], showmeans=True, showextrema=True) + assert isinstance(result1, dict), "Failed to create violin plot" + assert 'bodies' in result1, "Violin plot bodies are missing" + assert len(result1['bodies']) > 0, "Violin plot bodies are empty" result2 = ax.violinplot(values, positions=[datetime(2023, 1, 25)], widths=[ timedelta(days=12)], showmeans=True, showextrema=True) + assert isinstance(result2, dict), "Failed to create violin plot" + assert 'bodies' in result2, "Violin plot bodies are missing" + assert len(result2['bodies']) > 0, "Violin plot bodies are empty" result3 = ax.violinplot(values, positions=[datetime(2023, 2, 5)], widths=[ timedelta(days=8)], showmeans=True, showextrema=True) + assert isinstance(result3, dict), "Failed to create violin plot" + assert 'bodies' in result3, "Violin plot bodies are missing" + assert len(result3['bodies']) > 0, "Violin plot bodies are empty" ax.set_title( 'Violin Plot with DateTime Positions and Timedelta Widths') ax.set_xlabel('Dates') ax.set_ylabel('Values') plt.xticks(rotation=90) - assert isinstance(result, dict) - assert isinstance(result1, dict) - assert isinstance(result2, dict) - assert isinstance(result3, dict) assert result is not None, "Failed to create violin plot" @mpl.style.context("default")