@@ -16,13 +16,16 @@ def _inject_qtest_methods(cls):
16
16
17
17
def create_qtest_proxy_method (method_name ):
18
18
19
- qtest_method = getattr (QtTest .QTest , method_name )
19
+ if hasattr (QtTest .QTest , method_name ):
20
+ qtest_method = getattr (QtTest .QTest , method_name )
20
21
21
- def result (* args , ** kwargs ):
22
- return qtest_method (* args , ** kwargs )
22
+ def result (* args , ** kwargs ):
23
+ return qtest_method (* args , ** kwargs )
23
24
24
- functools .update_wrapper (result , qtest_method )
25
- return staticmethod (result )
25
+ functools .update_wrapper (result , qtest_method )
26
+ return staticmethod (result )
27
+ else :
28
+ return None
26
29
27
30
# inject methods from QTest into QtBot
28
31
method_names = [
@@ -43,7 +46,8 @@ def result(*args, **kwargs):
43
46
]
44
47
for method_name in method_names :
45
48
method = create_qtest_proxy_method (method_name )
46
- setattr (cls , method_name , method )
49
+ if method is not None :
50
+ setattr (cls , method_name , method )
47
51
48
52
return cls
49
53
@@ -113,7 +117,9 @@ class QtBot(object):
113
117
:param Qt.Key_* key: one of the constants for keys in the Qt namespace.
114
118
115
119
:return type: str
116
- :returns: the equivalent character string.
120
+ :returns: the equivalent character string.
121
+
122
+ .. note:: this method is not available in PyQt.
117
123
118
124
---
119
125
@@ -149,7 +155,7 @@ class QtBot(object):
149
155
:param int delay: after the event, delay the test for this miliseconds (if > 0).
150
156
151
157
152
- .. _QTest API: http://doc.qt.digia.com/4.7 /qtest.html
158
+ .. _QTest API: http://doc.qt.digia.com/4.8 /qtest.html
153
159
154
160
"""
155
161
0 commit comments