From 66f906e5326a8fb4444f6cfbcca779492d2665e4 Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 09:19:29 -0500 Subject: [PATCH 1/5] TST - Adding test_table() to test_datetimes.py --- lib/matplotlib/tests/test_datetime.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 53958229f174..e09070d48873 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -339,8 +339,12 @@ def test_streamplot(self): @pytest.mark.xfail(reason="Test for table not written yet") @mpl.style.context("default") def test_table(self): + val1 = np.array([datetime.datetime(2023, 9, n) for n in range(1, 4)]) + val2 = np.array([datetime.datetime(2022, 9, n) for n in range(1, 4)]) + val3 = [[datetime.datetime(2022, 9, c) for c in range(1, 4)] for r in range(1, 4)] fig, ax = plt.subplots() - ax.table(...) + ax.set_axis_off() + ax.table(cellText = val3, rowLabels = val2, colLabels = val1) @pytest.mark.xfail(reason="Test for text not written yet") @mpl.style.context("default") From 983b902180bf381a9b7692c25b29ece35b25a5d7 Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 09:46:19 -0500 Subject: [PATCH 2/5] fix formatting issues --- 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 e09070d48873..2165cd70e789 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -341,10 +341,11 @@ def test_streamplot(self): def test_table(self): val1 = np.array([datetime.datetime(2023, 9, n) for n in range(1, 4)]) val2 = np.array([datetime.datetime(2022, 9, n) for n in range(1, 4)]) - val3 = [[datetime.datetime(2022, 9, c) for c in range(1, 4)] for r in range(1, 4)] + val3 = [[datetime.datetime(2022, 9, c) for c in range(1, 4)] + for r in range(1, 4)] fig, ax = plt.subplots() ax.set_axis_off() - ax.table(cellText = val3, rowLabels = val2, colLabels = val1) + ax.table(cellText=val3, rowLabels=val2, colLabels=val1) @pytest.mark.xfail(reason="Test for text not written yet") @mpl.style.context("default") From 05968164c1f2c99cb0c37ca64dadfafae1ba46bf Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 09:53:40 -0500 Subject: [PATCH 3/5] Update test_datetime.py --- lib/matplotlib/tests/test_datetime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 2165cd70e789..4e3d364f80c6 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -341,8 +341,8 @@ def test_streamplot(self): def test_table(self): val1 = np.array([datetime.datetime(2023, 9, n) for n in range(1, 4)]) val2 = np.array([datetime.datetime(2022, 9, n) for n in range(1, 4)]) - val3 = [[datetime.datetime(2022, 9, c) for c in range(1, 4)] - for r in range(1, 4)] + val3 = [[datetime.datetime(2022, 9, c) for c in range(1, 4)] + for r in range(1, 4)] fig, ax = plt.subplots() ax.set_axis_off() ax.table(cellText=val3, rowLabels=val2, colLabels=val1) From 734c5f77b474ea988007e8e0d85210c8ba7df30c Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 09:57:37 -0500 Subject: [PATCH 4/5] fixing linting issues --- 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 4e3d364f80c6..2c4776d3e5c0 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -342,7 +342,7 @@ def test_table(self): val1 = np.array([datetime.datetime(2023, 9, n) for n in range(1, 4)]) val2 = np.array([datetime.datetime(2022, 9, n) for n in range(1, 4)]) val3 = [[datetime.datetime(2022, 9, c) for c in range(1, 4)] - for r in range(1, 4)] + for r in range(1, 4)] fig, ax = plt.subplots() ax.set_axis_off() ax.table(cellText=val3, rowLabels=val2, colLabels=val1) From bcf839f108a4740b2fb0fd272451a2c3d954d371 Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 13:43:04 -0500 Subject: [PATCH 5/5] Remove failure default for new test --- 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 2c4776d3e5c0..ef863b4c278f 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -336,7 +336,6 @@ def test_streamplot(self): fig, ax = plt.subplots() ax.streamplot(...) - @pytest.mark.xfail(reason="Test for table not written yet") @mpl.style.context("default") def test_table(self): val1 = np.array([datetime.datetime(2023, 9, n) for n in range(1, 4)])