8000 fix tests · matplotlib/matplotlib@b22193b · GitHub
[go: up one dir, main page]

Skip to content

Commit b22193b

Browse files
committed
fix tests
1 parent 41fdfae commit b22193b

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

lib/matplotlib/tests/test_backend_qt4.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212

1313
try:
1414
from matplotlib.backends.qt4_compat import QtCore
15-
from matplotlib.backends.backend_qt import MODIFIER_KEYS
16-
HAS_QT = True
15+
from matplotlib.backends.backend_qt4 import MODIFIER_KEYS, SUPER, ALT, CTRL, SHIFT
16+
17+
_, ControlModifier, ControlKey = MODIFIER_KEYS[CTRL]
18+
_, AltModifier, AltKey = MODIFIER_KEYS[ALT]
19+
_, SuperModifier, SuperKey = MODIFIER_KEYS[SUPER]
20+
_, ShiftModifier, ShiftKey = MODIFIER_KEYS[SHIFT]
1721

18-
ShiftModifier = QtCore.Qt.ShiftModifier
19-
ControlModifier, ControlKey = MODIFIER_KEYS['ctrl']
20-
AltModifier, AltKey = MODIFIER_KEYS['alt']
21-
SuperModifier, SuperKey = MODIFIER_KEYS['super']
22-
except ImportError:
22+
HAS_QT = True
23+
except ImportError as e:
2324
HAS_QT = False
2425

2526

@@ -72,7 +73,7 @@ def test_shift():
7273

7374
@cleanup
7475
@knownfailureif(not HAS_QT)
75-
def test_noshift():
76+
def test_lower():
7677
assert_correct_key(QtCore.Qt.Key_A,
7778
QtCore.Qt.NoModifier,
7879
u'a',
@@ -90,7 +91,7 @@ def test_control():
9091

9192
@cleanup
9293
@knownfailureif(not HAS_QT)
93-
def test_unicode():
94+
def test_unicode_upper():
9495
assert_correct_key(QtCore.Qt.Key_Aacute,
9596
ShiftModifier,
9697
unichr(193),
@@ -99,7 +100,7 @@ def test_unicode():
99100

100101
@cleanup
101102
@knownfailureif(not HAS_QT)
102-
def test_unicode_noshift():
103+
def test_unicode_lower():
103104
assert_correct_key(QtCore.Qt.Key_Aacute,
104105
QtCore.Qt.NoModifier,
105106
unichr(193),
@@ -109,7 +110,7 @@ def test_unicode_noshift():
109110
@cleanup
110111
@knownfailureif(not HAS_QT)
111112
def test_alt_control():
112-
assert_correct_key(QtCore.Qt.Key_Control,
113+
assert_correct_key(ControlKey,
113114
AltModifier,
114115
u'',
115116
u'alt+control')
@@ -118,7 +119,7 @@ def test_alt_control():
118119
@cleanup
119120
@knownfailureif(not HAS_QT)
120121
def test_control_alt():
121-
assert_correct_key(QtCore.Qt.Key_Alt,
122+
assert_correct_key(AltKey,
122123
ControlModifier,
123124
u'',
124125
u'ctrl+alt')
@@ -128,6 +129,6 @@ def test_control_alt():
128129
@knownfailureif(not HAS_QT)
129130
def test_modifier_order():
130131
assert_correct_key(QtCore.Qt.Key_Aacute,
131-
(ControlModifier & AltModifier & SuperModifier),
132+
(ControlModifier | AltModifier | SuperModifier),
132133
u'',
133134
u'ctrl+alt+super+' + unichr(225))

0 commit comments

Comments
 (0)
0