From ffcba73b42dc24811f33edc31caff662a05bc711 Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 08:28:24 -0500 Subject: [PATCH 1/4] TEST - adding new test for axes.table Adding test to check that axes.table can plot with date time units --- lib/matplotlib/tests/test_datetime.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 53958229f174..2075afa3a05c 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -339,8 +339,14 @@ def test_streamplot(self): @pytest.mark.xfail(reason="Test for table not written yet") @mpl.style.context("default") def test_table(self): - fig, ax = plt.subplots() - ax.table(...) + 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.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 8811bc57be828ca4f9a16f25674dc291149be530 Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 08:48:18 -0500 Subject: [PATCH 2/4] Fixing formatting of new axes_table date time test --- lib/matplotlib/tests/test_datetime.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 2075afa3a05c..077dd6b5550d 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -339,14 +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)]) + 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.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 89a5ce51ad27ed318ffaa38fbff2378c22047c4d Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 08:53:00 -0500 Subject: [PATCH 3/4] fixing formatting of new test --- 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 077dd6b5550d..9c35d7f9050c 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -344,7 +344,7 @@ def test_table(self): 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 76db8c5cbf40ff4939344faa3d8b2773c098deb4 Mon Sep 17 00:00:00 2001 From: iandw Date: Sat, 23 Sep 2023 09:09:29 -0500 Subject: [PATCH 4/4] Fix formatting --- lib/matplotlib/tests/test_datetime.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 9c35d7f9050c..e09070d48873 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -339,9 +339,9 @@ 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)] + 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.set_axis_off() ax.table(cellText = val3, rowLabels = val2, colLabels = val1)