Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6ef592

Browse files
committed
TST: simplify how we do the OSX (re-re)-patching
1 parent 5d8e293 commit f6ef592

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

lib/matplotlib/tests/test_backend_qt.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -170,35 +170,19 @@ def custom_handler(signum, frame):
170170
[
171171
("Key_A", ["ShiftModifier"], "A"),
172172
("Key_A", [], "a"),
173-
(
174-
"Key_A",
175-
["ControlModifier"],
176-
("ctrl+a" if sys.platform != "darwin" else "cmd+a"),
177-
),
173+
("Key_A", ["ControlModifier"], ("ctrl+a")),
178174
(
179175
"Key_Aacute",
180176
["ShiftModifier"],
181-
"\N{LATIN CAPITAL LETTER A WITH ACUTE}"
177+
"\N{LATIN CAPITAL LETTER A WITH ACUTE}",
182178
),
183179
("Key_Aacute", [], "\N{LATIN SMALL LETTER A WITH ACUTE}"),
184-
(
185-
"Key_Control",
186-
["AltModifier"],
187-
("alt+control" if sys.platform != "darwin" else "alt+cmd"),
188-
),
189-
(
190-
"Key_Alt",
191-
["ControlModifier"],
192-
"ctrl+alt" if sys.platform != "darwin" else "cmd+alt",
193-
),
180+
("Key_Control", ["AltModifier"], ("alt+ctrl")),
181+
("Key_Alt", ["ControlModifier"], "ctrl+alt"),
194182
(
195183
"Key_Aacute",
196184
["ControlModifier", "AltModifier", "MetaModifier"],
197-
(
198-
"ctrl+alt+meta+\N{LATIN SMALL LETTER A WITH ACUTE}"
199-
if sys.platform != "darwin"
200-
else "cmd+alt+ctrl+\N{LATIN SMALL LETTER A WITH ACUTE}"
201-
),
185+
("ctrl+alt+meta+\N{LATIN SMALL LETTER A WITH ACUTE}"),
202186
),
203187
# We do not currently map the media keys, this may change in the
204188
# future. This means the callback will never fire
@@ -207,7 +191,7 @@ def custom_handler(signum, frame):
207191
(
208192
"Key_Backspace",
209193
["ControlModifier"],
210-
"ctrl+backspace" if sys.platform != "darwin" else "cmd+backspace",
194+
"ctrl+backspace",
211195
),
212196
],
213197
ids=[
@@ -241,6 +225,10 @@ def test_correct_key(backend, qt_core, qt_key, qt_mods, answer):
241225
Assert sent and caught keys are the same.
242226
"""
243227
from matplotlib.backends.qt_compat import _enum, _to_int
228+
229+
if sys.platform == "darwin" and answer is not None:
230+
answer = answer.replace("ctrl", "cmd")
231+
answer = answer.replace("meta", "ctrl")
244232
result = None
245233
qt_mod = _enum("QtCore.Qt.KeyboardModifier").NoModifier
246234
for mod in qt_mods:

0 commit comments

Comments
 (0)