tests: Make FakeSignal callable.
This commit is contained in:
parent
38ebd806cc
commit
18af0b4b35
@ -206,10 +206,22 @@ def fake_qprocess():
|
|||||||
|
|
||||||
class FakeSignal:
|
class FakeSignal:
|
||||||
|
|
||||||
"""Fake pyqtSignal stub which does nothing."""
|
"""Fake pyqtSignal stub which does nothing.
|
||||||
|
|
||||||
def __init__(self, name='fake'):
|
Attributes:
|
||||||
|
signal: The name of the signal, like pyqtSignal.
|
||||||
|
_func: The function to be invoked when the signal gets called.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name='fake', func=None):
|
||||||
self.signal = '2{}(int, int)'.format(name)
|
self.signal = '2{}(int, int)'.format(name)
|
||||||
|
self._func = func
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
if self._func is None:
|
||||||
|
raise TypeError("'FakeSignal' object is not callable")
|
||||||
|
else:
|
||||||
|
return self._func()
|
||||||
|
|
||||||
def connect(self, slot):
|
def connect(self, slot):
|
||||||
"""Connect the signal to a slot.
|
"""Connect the signal to a slot.
|
||||||
|
Loading…
Reference in New Issue
Block a user