File: fix-matplotlib-3.10.patch

package info (click to toggle)
seaborn 0.13.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,608 kB
  • sloc: python: 37,241; makefile: 182; javascript: 45; sh: 15
file content (57 lines) | stat: -rw-r--r-- 2,366 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 385e54676ca16d0132434bc9df6bc41ea8b2a0d4 Mon Sep 17 00:00:00 2001
From: Michael Waskom <mwaskom@users.noreply.github.com>
Date: Mon, 16 Dec 2024 07:54:02 -0500
Subject: [PATCH] Fix tick visibility introspection on 3.10 (#3802)

---
 tests/_core/test_plot.py | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

--- a/tests/_core/test_plot.py
+++ b/tests/_core/test_plot.py
@@ -1782,6 +1782,17 @@
 
 class TestLabelVisibility:
 
+    def has_xaxis_labels(self, ax):
+        if _version_predates(mpl, "3.7"):
+            # mpl3.7 added a getter for tick params, but both yaxis and xaxis return
+            # the same entry of "labelleft" instead of "labelbottom" for xaxis
+            return len(ax.get_xticklabels()) > 0
+        elif _version_predates(mpl, "3.10"):
+            # Then I guess they made it labelbottom in 3.10?
+            return ax.xaxis.get_tick_params()["labelleft"]
+        else:
+            return ax.xaxis.get_tick_params()["labelbottom"]
+
     def test_single_subplot(self, long_df):
 
         x, y = "a", "z"
@@ -1852,12 +1863,7 @@
         for s in subplots[1:]:
             ax = s["ax"]
             assert ax.xaxis.get_label().get_visible()
-            # mpl3.7 added a getter for tick params, but both yaxis and xaxis return
-            # the same entry of "labelleft" instead of  "labelbottom" for xaxis
-            if not _version_predates(mpl, "3.7"):
-                assert ax.xaxis.get_tick_params()["labelleft"]
-            else:
-                assert len(ax.get_xticklabels()) > 0
+            assert self.has_xaxis_labels(ax)
             assert all(t.get_visible() for t in ax.get_xticklabels())
 
         for s in subplots[1:-1]:
@@ -1882,12 +1888,7 @@
         for s in subplots[-2:]:
             ax = s["ax"]
             assert ax.xaxis.get_label().get_visible()
-            # mpl3.7 added a getter for tick params, but both yaxis and xaxis return
-            # the same entry of "labelleft" instead of  "labelbottom" for xaxis
-            if not _version_predates(mpl, "3.7"):
-                assert ax.xaxis.get_tick_params()["labelleft"]
-            else:
-                assert len(ax.get_xticklabels()) > 0
+            assert self.has_xaxis_labels(ax)
             assert all(t.get_visible() for t in ax.get_xticklabels())
 
         for s in subplots[:-2]: