aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/signals
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/tests/signals')
-rw-r--r--sources/pyside6/tests/signals/args_dont_match_test.py1
-rw-r--r--sources/pyside6/tests/signals/bug_311.py10
-rw-r--r--sources/pyside6/tests/signals/bug_312.py5
-rw-r--r--sources/pyside6/tests/signals/bug_319.py5
-rw-r--r--sources/pyside6/tests/signals/bug_79.py1
-rw-r--r--sources/pyside6/tests/signals/decorators_test.py4
-rw-r--r--sources/pyside6/tests/signals/disconnect_test.py2
-rw-r--r--sources/pyside6/tests/signals/invalid_callback_test.py8
-rw-r--r--sources/pyside6/tests/signals/lambda_gui_test.py5
-rw-r--r--sources/pyside6/tests/signals/lambda_test.py4
-rw-r--r--sources/pyside6/tests/signals/leaking_signal_test.py1
-rw-r--r--sources/pyside6/tests/signals/multiple_connections_gui_test.py3
-rw-r--r--sources/pyside6/tests/signals/multiple_connections_test.py4
-rw-r--r--sources/pyside6/tests/signals/pysignal_test.py3
-rw-r--r--sources/pyside6/tests/signals/qobject_destroyed_test.py2
-rw-r--r--sources/pyside6/tests/signals/qobject_receivers_test.py2
-rw-r--r--sources/pyside6/tests/signals/qobject_sender_test.py6
-rw-r--r--sources/pyside6/tests/signals/ref01_test.py2
-rw-r--r--sources/pyside6/tests/signals/ref02_test.py2
-rw-r--r--sources/pyside6/tests/signals/ref03_test.py2
-rw-r--r--sources/pyside6/tests/signals/ref04_test.py1
-rw-r--r--sources/pyside6/tests/signals/ref05_test.py1
-rw-r--r--sources/pyside6/tests/signals/ref06_test.py1
-rw-r--r--sources/pyside6/tests/signals/segfault_proxyparent_test.py3
-rw-r--r--sources/pyside6/tests/signals/self_connect_test.py1
-rw-r--r--sources/pyside6/tests/signals/short_circuit_test.py5
-rw-r--r--sources/pyside6/tests/signals/signal2signal_connect_test.py16
-rw-r--r--sources/pyside6/tests/signals/signal_autoconnect_test.py1
-rw-r--r--sources/pyside6/tests/signals/signal_connectiontype_support_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_emission_gui_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_emission_test.py16
-rw-r--r--sources/pyside6/tests/signals/signal_enum_test.py1
-rw-r--r--sources/pyside6/tests/signals/signal_func_test.py6
-rw-r--r--sources/pyside6/tests/signals/signal_manager_refcount_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_number_limit_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_object_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_signature_test.py8
-rw-r--r--sources/pyside6/tests/signals/signal_with_primitive_type_test.py1
-rw-r--r--sources/pyside6/tests/signals/slot_reference_count_test.py4
-rw-r--r--sources/pyside6/tests/signals/static_metaobject_test.py3
40 files changed, 113 insertions, 37 deletions
diff --git a/sources/pyside6/tests/signals/args_dont_match_test.py b/sources/pyside6/tests/signals/args_dont_match_test.py
index 78b081d3e..8b3f2b5c7 100644
--- a/sources/pyside6/tests/signals/args_dont_match_test.py
+++ b/sources/pyside6/tests/signals/args_dont_match_test.py
@@ -54,6 +54,5 @@ class ArgsDontMatch(unittest.TestCase):
self.assertTrue(self.ok)
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_311.py b/sources/pyside6/tests/signals/bug_311.py
index f05796563..0bf3cdcf3 100644
--- a/sources/pyside6/tests/signals/bug_311.py
+++ b/sources/pyside6/tests/signals/bug_311.py
@@ -41,22 +41,25 @@ init_test_paths(False)
from PySide6.QtCore import QDate, QObject, Signal
from helper.usesqcoreapplication import UsesQCoreApplication
+
class DerivedDate(QDate):
- def __init__(self,y,m,d):
- super().__init__(y,m,d)
+ def __init__(self, y, m, d):
+ super().__init__(y, m, d)
+
class Emitter(QObject):
dateSignal1 = Signal(QDate)
dateSignal2 = Signal(DerivedDate)
tupleSignal = Signal(tuple)
+
class SignaltoSignalTest(UsesQCoreApplication):
def myCb(self, dt):
self._dt = dt
def testBug(self):
e = Emitter()
- d = DerivedDate(2010,8,24)
+ d = DerivedDate(2010, 8, 24)
self._dt = None
e.dateSignal1.connect(self.myCb)
e.dateSignal1.emit(d)
@@ -73,6 +76,7 @@ class SignaltoSignalTest(UsesQCoreApplication):
e.tupleSignal.emit(myTuple)
self.assertEqual(myTuple, self._dt)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_312.py b/sources/pyside6/tests/signals/bug_312.py
index d0543b68f..234e34000 100644
--- a/sources/pyside6/tests/signals/bug_312.py
+++ b/sources/pyside6/tests/signals/bug_312.py
@@ -43,6 +43,7 @@ from PySide6.QtCore import QObject, SIGNAL
MAX_LOOPS = 5
MAX_OBJECTS = 200
+
class Dummy(object):
def __init__(self, parent):
self._parent = parent
@@ -50,6 +51,7 @@ class Dummy(object):
def callback(self):
self._called = True
+
class MultipleSlots(unittest.TestCase):
def myCB(self):
self._count += 1
@@ -77,9 +79,10 @@ class MultipleSlots(unittest.TestCase):
self.assertEqual(self._count, MAX_OBJECTS)
- #delete all senders will disconnect the signals
+ # delete all senders will disconnect the signals
self._senders = []
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_319.py b/sources/pyside6/tests/signals/bug_319.py
index 87dc9c053..bd46b9632 100644
--- a/sources/pyside6/tests/signals/bug_319.py
+++ b/sources/pyside6/tests/signals/bug_319.py
@@ -52,10 +52,12 @@ class Listener(QObject):
for w in words:
self._phrase.append(w)
+
class Communicate(QObject):
# create a new signal on the fly and name it 'speak'
speak = Signal(tuple)
+
class SignaltoSignalTest(UsesQCoreApplication):
def testBug(self):
someone = Communicate()
@@ -63,10 +65,11 @@ class SignaltoSignalTest(UsesQCoreApplication):
# connect signal and slot
someone.speak.connect(someone2.listen)
# emit 'speak' signal
- talk = ("one","two","three")
+ talk = ("one", "two", "three")
someone.speak.emit(talk)
self.assertEqual(someone2._phrase, list(talk))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_79.py b/sources/pyside6/tests/signals/bug_79.py
index 9b91a8825..fc70ddaee 100644
--- a/sources/pyside6/tests/signals/bug_79.py
+++ b/sources/pyside6/tests/signals/bug_79.py
@@ -46,6 +46,7 @@ try:
except ImportError:
skiptest = True
+
class ConnectTest(unittest.TestCase):
def callback(self, o):
diff --git a/sources/pyside6/tests/signals/decorators_test.py b/sources/pyside6/tests/signals/decorators_test.py
index f8d51383f..346a75101 100644
--- a/sources/pyside6/tests/signals/decorators_test.py
+++ b/sources/pyside6/tests/signals/decorators_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Slot, SIGNAL, SLOT
+
class MyObject(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -69,6 +70,7 @@ class MyObject(QObject):
def mySlot6(self):
self._slotCalledCount = self._slotCalledCount + 1
+
class StaticMetaObjectTest(unittest.TestCase):
def testSignalPropagation(self):
@@ -100,6 +102,7 @@ class StaticMetaObjectTest(unittest.TestCase):
m = mo.method(i)
self.assertEqual(m.typeName(), "QObject*")
+
class SlotWithoutArgs(unittest.TestCase):
def testError(self):
@@ -108,5 +111,6 @@ class SlotWithoutArgs(unittest.TestCase):
# accepting argument functions
self.assertRaises(TypeError, Slot, lambda: 3)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/disconnect_test.py b/sources/pyside6/tests/signals/disconnect_test.py
index 281bc5c66..9f97461ee 100644
--- a/sources/pyside6/tests/signals/disconnect_test.py
+++ b/sources/pyside6/tests/signals/disconnect_test.py
@@ -42,6 +42,7 @@ from testbinding import TestObject
class Foo(QObject):
bar = Signal()
+
class TestDisconnect(unittest.TestCase):
def theSlot1(self):
self.called1 = True
@@ -73,6 +74,7 @@ class TestDisconnect(unittest.TestCase):
self.called = False
obj = TestObject(0)
+
def callback():
obj.signalWithDefaultValue.disconnect(callback)
diff --git a/sources/pyside6/tests/signals/invalid_callback_test.py b/sources/pyside6/tests/signals/invalid_callback_test.py
index 33a43204f..5933aee2e 100644
--- a/sources/pyside6/tests/signals/invalid_callback_test.py
+++ b/sources/pyside6/tests/signals/invalid_callback_test.py
@@ -39,25 +39,27 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class InvalidCallback(unittest.TestCase):
'''Test case for passing an invalid callback to QObject.connect'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.obj = QObject()
def tearDown(self):
- #Release resources
+ # Release resources
try:
del self.obj
except AttributeError:
pass
def testIntegerCb(self):
- #Test passing an int as callback to QObject.connect
+ # Test passing an int as callback to QObject.connect
self.assertRaises(TypeError, QObject.connect, self.obj,
SIGNAL('destroyed()'), 42)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/lambda_gui_test.py b/sources/pyside6/tests/signals/lambda_gui_test.py
index 0de00d7aa..e7b88ab5f 100644
--- a/sources/pyside6/tests/signals/lambda_gui_test.py
+++ b/sources/pyside6/tests/signals/lambda_gui_test.py
@@ -55,7 +55,7 @@ if hasQtGui:
class QtGuiSigLambda(UsesQApplication):
def testButton(self):
- #Connecting a lambda to a QPushButton.clicked()
+ # Connecting a lambda to a QPushButton.clicked()
obj = QPushButton('label')
ctr = Control()
func = lambda: setattr(ctr, 'arg', True)
@@ -64,9 +64,8 @@ if hasQtGui:
self.assertTrue(ctr.arg)
QObject.disconnect(obj, SIGNAL('clicked()'), func)
-
def testSpinButton(self):
- #Connecting a lambda to a QPushButton.clicked()
+ # Connecting a lambda to a QPushButton.clicked()
obj = QSpinBox()
ctr = Control()
arg = 444
diff --git a/sources/pyside6/tests/signals/lambda_test.py b/sources/pyside6/tests/signals/lambda_test.py
index ec130edee..74d5cc900 100644
--- a/sources/pyside6/tests/signals/lambda_test.py
+++ b/sources/pyside6/tests/signals/lambda_test.py
@@ -53,7 +53,7 @@ class Dummy(QObject):
class BasicCase(unittest.TestCase):
def testSimplePythonSignalNoArgs(self):
- #Connecting a lambda to a simple python signal without arguments
+ # Connecting a lambda to a simple python signal without arguments
obj = Dummy()
QObject.connect(obj, SIGNAL('foo()'),
lambda: setattr(obj, 'called', True))
@@ -61,7 +61,7 @@ class BasicCase(unittest.TestCase):
self.assertTrue(obj.called)
def testSimplePythonSignal(self):
- #Connecting a lambda to a simple python signal witharguments
+ # Connecting a lambda to a simple python signal witharguments
obj = Dummy()
arg = 42
QObject.connect(obj, SIGNAL('foo(int)'),
diff --git a/sources/pyside6/tests/signals/leaking_signal_test.py b/sources/pyside6/tests/signals/leaking_signal_test.py
index 35662b36a..3b16a3fb6 100644
--- a/sources/pyside6/tests/signals/leaking_signal_test.py
+++ b/sources/pyside6/tests/signals/leaking_signal_test.py
@@ -48,5 +48,6 @@ class LeakingSignal(unittest.TestCase):
emitter = Emitter()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/multiple_connections_gui_test.py b/sources/pyside6/tests/signals/multiple_connections_gui_test.py
index fe879e624..153ea1e81 100644
--- a/sources/pyside6/tests/signals/multiple_connections_gui_test.py
+++ b/sources/pyside6/tests/signals/multiple_connections_gui_test.py
@@ -48,6 +48,7 @@ except ImportError:
from helper.basicpyslotcase import BasicPySlotCase
from helper.usesqapplication import UsesQApplication
+
class MultipleSignalConnections(unittest.TestCase):
'''Base class for multiple signal connection testing'''
@@ -87,7 +88,7 @@ if hasQtGui:
def testSpinBoxValueChanged(self):
"""Multiple connections to QSpinBox.valueChanged(int)"""
sender = QSpinBox()
- #FIXME if number of receivers if higher than 50, segfaults
+ # FIXME if number of receivers if higher than 50, segfaults
receivers = [BasicPySlotCase() for x in range(10)]
self.run_many(sender, 'valueChanged(int)', sender.setValue,
receivers, (1,))
diff --git a/sources/pyside6/tests/signals/multiple_connections_test.py b/sources/pyside6/tests/signals/multiple_connections_test.py
index 1f9d95c41..75f8ddc34 100644
--- a/sources/pyside6/tests/signals/multiple_connections_test.py
+++ b/sources/pyside6/tests/signals/multiple_connections_test.py
@@ -78,7 +78,8 @@ class PythonMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
sender = Dummy()
receivers = [BasicPySlotCase() for x in range(10)]
- self.run_many(sender, 'foobar(int)', partial(sender.emit,SIGNAL('foobar(int)')), receivers, (0, ))
+ self.run_many(sender, 'foobar(int)', partial(sender.emit,
+ SIGNAL('foobar(int)')), receivers, (0, ))
class QProcessMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
@@ -106,5 +107,6 @@ class QProcessMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
self.run_many(sender, 'finished(int)', start_proc, receivers, (0,))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/pysignal_test.py b/sources/pyside6/tests/signals/pysignal_test.py
index bc6310f5a..86c05324a 100644
--- a/sources/pyside6/tests/signals/pysignal_test.py
+++ b/sources/pyside6/tests/signals/pysignal_test.py
@@ -45,6 +45,7 @@ except ImportError:
from helper.usesqapplication import UsesQApplication
+
class Dummy(QObject):
"""Dummy class used in this test."""
def __init__(self, parent=None):
@@ -112,6 +113,7 @@ class PyObjectType(UsesQApplication):
self.app.exec_()
self.assertEqual(self.callCount, 2)
+
class PythonSigSlot(unittest.TestCase):
def setUp(self):
self.called = False
@@ -146,7 +148,6 @@ class PythonSigSlot(unittest.TestCase):
self.assertTrue(self.called)
-
def testDisconnect(self):
obj1 = Dummy()
diff --git a/sources/pyside6/tests/signals/qobject_destroyed_test.py b/sources/pyside6/tests/signals/qobject_destroyed_test.py
index 02298164a..6129b5c65 100644
--- a/sources/pyside6/tests/signals/qobject_destroyed_test.py
+++ b/sources/pyside6/tests/signals/qobject_destroyed_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class QObjectDestroyed(unittest.TestCase):
"""Very simple test case for the destroyed() signal of QObject"""
@@ -53,5 +54,6 @@ class QObjectDestroyed(unittest.TestCase):
del obj
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/qobject_receivers_test.py b/sources/pyside6/tests/signals/qobject_receivers_test.py
index 920cd2264..4e2388e29 100644
--- a/sources/pyside6/tests/signals/qobject_receivers_test.py
+++ b/sources/pyside6/tests/signals/qobject_receivers_test.py
@@ -45,6 +45,7 @@ from PySide6.QtCore import QObject, SIGNAL, SLOT
def cute_slot():
pass
+
class TestQObjectReceivers(unittest.TestCase):
'''Test case for QObject::receivers'''
@@ -81,5 +82,6 @@ class TestQObjectReceivers(unittest.TestCase):
sender.connect(sender, SIGNAL("some_dynamic_signal()"), receiver, SLOT("deleteLater()"))
self.assertEqual(sender.receivers(SIGNAL("some_dynamic_signal( )")), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/qobject_sender_test.py b/sources/pyside6/tests/signals/qobject_sender_test.py
index 15b04dda3..6ed84a55f 100644
--- a/sources/pyside6/tests/signals/qobject_sender_test.py
+++ b/sources/pyside6/tests/signals/qobject_sender_test.py
@@ -48,6 +48,7 @@ class ExtQTimer(QTimer):
def __init__(self):
super().__init__()
+
class Receiver(QObject):
def __init__(self):
super().__init__()
@@ -58,6 +59,7 @@ class Receiver(QObject):
if QCoreApplication.instance():
QCoreApplication.instance().exit()
+
class ObjectSenderTest(unittest.TestCase):
'''Test case for QObject.sender() method.'''
@@ -68,6 +70,7 @@ class ObjectSenderTest(unittest.TestCase):
sender.emit(SIGNAL('foo()'))
self.assertEqual(sender, recv.the_sender)
+
class ObjectSenderCheckOnReceiverTest(unittest.TestCase):
'''Test case for QObject.sender() method, this one tests the equality on the Receiver object.'''
@@ -78,6 +81,7 @@ class ObjectSenderCheckOnReceiverTest(unittest.TestCase):
sender.emit(SIGNAL('foo()'))
self.assertEqual(sender, recv.the_sender)
+
class ObjectSenderWithQAppTest(UsesQCoreApplication):
'''Test case for QObject.sender() method with QApplication.'''
@@ -104,6 +108,7 @@ class ObjectSenderWithQAppTest(UsesQCoreApplication):
self.app.exec_()
self.assertEqual(sender, recv.the_sender)
+
class ObjectSenderWithQAppCheckOnReceiverTest(UsesQCoreApplication):
'''Test case for QObject.sender() method with QApplication.'''
@@ -124,6 +129,7 @@ class ObjectSenderWithQAppCheckOnReceiverTest(UsesQCoreApplication):
self.app.exec_()
self.assertEqual(sender, recv.the_sender)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref01_test.py b/sources/pyside6/tests/signals/ref01_test.py
index 1692a8079..bce0e8264 100644
--- a/sources/pyside6/tests/signals/ref01_test.py
+++ b/sources/pyside6/tests/signals/ref01_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal
+
class BoundAndUnboundSignalsTest(unittest.TestCase):
def setUp(self):
@@ -57,6 +58,7 @@ class BoundAndUnboundSignalsTest(unittest.TestCase):
self.assertNotEqual(type(obj.destroyed), Signal)
self.assertTrue(self.methods.issubset(dir(obj.destroyed)))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref02_test.py b/sources/pyside6/tests/signals/ref02_test.py
index 775d66b37..d516a1e67 100644
--- a/sources/pyside6/tests/signals/ref02_test.py
+++ b/sources/pyside6/tests/signals/ref02_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication, QTimeLine
from helper.usesqcoreapplication import UsesQCoreApplication
+
class NativeSignalsTest(UsesQCoreApplication):
def setUp(self):
@@ -78,6 +79,7 @@ class NativeSignalsTest(UsesQCoreApplication):
self.app.exec_()
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref03_test.py b/sources/pyside6/tests/signals/ref03_test.py
index a17d2eaa5..01fba47f9 100644
--- a/sources/pyside6/tests/signals/ref03_test.py
+++ b/sources/pyside6/tests/signals/ref03_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class DisconnectSignalsTest(unittest.TestCase):
def setUp(self):
@@ -60,6 +61,7 @@ class DisconnectSignalsTest(unittest.TestCase):
self.emitter.destroyed.disconnect(destroyedSlot)
self.assertEqual(getrefcount(destroyedSlot), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref04_test.py b/sources/pyside6/tests/signals/ref04_test.py
index 62f45ac73..9d3103ea7 100644
--- a/sources/pyside6/tests/signals/ref04_test.py
+++ b/sources/pyside6/tests/signals/ref04_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal
+
class ExtQObject(QObject):
mySignal = Signal()
diff --git a/sources/pyside6/tests/signals/ref05_test.py b/sources/pyside6/tests/signals/ref05_test.py
index e16f7e391..5d64684dd 100644
--- a/sources/pyside6/tests/signals/ref05_test.py
+++ b/sources/pyside6/tests/signals/ref05_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Slot
from helper.usesqcoreapplication import UsesQCoreApplication
+
class ExtQObject(QObject):
def __init__(self):
diff --git a/sources/pyside6/tests/signals/ref06_test.py b/sources/pyside6/tests/signals/ref06_test.py
index f86ea4b74..f6c27c9f2 100644
--- a/sources/pyside6/tests/signals/ref06_test.py
+++ b/sources/pyside6/tests/signals/ref06_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Signal, Slot
from helper.usesqcoreapplication import UsesQCoreApplication
+
class ExtQObject(QObject):
signalbetween = Signal('qreal')
diff --git a/sources/pyside6/tests/signals/segfault_proxyparent_test.py b/sources/pyside6/tests/signals/segfault_proxyparent_test.py
index 4a5847634..4a8dd0d19 100644
--- a/sources/pyside6/tests/signals/segfault_proxyparent_test.py
+++ b/sources/pyside6/tests/signals/segfault_proxyparent_test.py
@@ -47,14 +47,17 @@ from PySide6.QtCore import QObject, SIGNAL
# In PyQt4, the connection works fine with the same memory behavior,
# so it looks like specific to SIP.
+
class Dummy(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class Joe(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class SegfaultCase(unittest.TestCase):
"""Test case for the segfault happening when parent() is called inside
ProxyObject"""
diff --git a/sources/pyside6/tests/signals/self_connect_test.py b/sources/pyside6/tests/signals/self_connect_test.py
index 0d89d535d..96189e315 100644
--- a/sources/pyside6/tests/signals/self_connect_test.py
+++ b/sources/pyside6/tests/signals/self_connect_test.py
@@ -67,6 +67,5 @@ class SelfConnect(UsesQApplication):
self.assertTrue(not window.isVisible())
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/short_circuit_test.py b/sources/pyside6/tests/signals/short_circuit_test.py
index 8a9483331..d0f45891d 100644
--- a/sources/pyside6/tests/signals/short_circuit_test.py
+++ b/sources/pyside6/tests/signals/short_circuit_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, SLOT
+
class Dummy(QObject):
"""Dummy class used in this test."""
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class ShortCircuitSignals(unittest.TestCase):
def setUp(self):
self.called = False
@@ -79,7 +81,7 @@ class ShortCircuitSignals(unittest.TestCase):
obj1 = Dummy()
QObject.connect(obj1, SIGNAL('foo(int,int,QString)'), self.callback)
- self.args = (42,33,'char')
+ self.args = (42, 33, 'char')
obj1.emit(SIGNAL('foo(int,int,QString)'), *self.args)
self.assertTrue(self.called)
@@ -94,5 +96,6 @@ class ShortCircuitSignals(unittest.TestCase):
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal2signal_connect_test.py b/sources/pyside6/tests/signals/signal2signal_connect_test.py
index 41a507fe5..05a6b6e72 100644
--- a/sources/pyside6/tests/signals/signal2signal_connect_test.py
+++ b/sources/pyside6/tests/signals/signal2signal_connect_test.py
@@ -45,18 +45,19 @@ from PySide6.QtCore import QObject, SIGNAL
def cute_slot():
pass
+
class TestSignal2SignalConnect(unittest.TestCase):
'''Test case for signal to signal connections'''
def setUp(self):
- #Set up the basic resources needed
+ # Set up the basic resources needed
self.sender = QObject()
self.forwarder = QObject()
self.args = None
self.called = False
def tearDown(self):
- #Delete used resources
+ # Delete used resources
try:
del self.sender
except:
@@ -68,24 +69,23 @@ class TestSignal2SignalConnect(unittest.TestCase):
del self.args
def callback_noargs(self):
- #Default callback without arguments
+ # Default callback without arguments
self.called = True
def callback_args(self, *args):
- #Default callback with arguments
+ # Default callback with arguments
if args == self.args:
self.called = True
else:
raise TypeError("Invalid arguments")
def callback_qobject(self, *args):
- #Default callback for QObject as argument
+ # Default callback for QObject as argument
if args[0].objectName() == self.args[0]:
self.called = True
else:
raise TypeError("Invalid arguments")
-
def testSignalWithoutArguments(self):
QObject.connect(self.sender, SIGNAL("destroyed()"),
self.forwarder, SIGNAL("forward()"))
@@ -94,7 +94,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
del self.sender
self.assertTrue(self.called)
-
def testSignalWithOnePrimitiveTypeArgument(self):
QObject.connect(self.sender, SIGNAL("mysignal(int)"),
self.forwarder, SIGNAL("mysignal(int)"))
@@ -104,7 +103,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
self.sender.emit(SIGNAL('mysignal(int)'), *self.args)
self.assertTrue(self.called)
-
def testSignalWithMultiplePrimitiveTypeArguments(self):
QObject.connect(self.sender, SIGNAL("mysignal(int,int)"),
self.forwarder, SIGNAL("mysignal(int,int)"))
@@ -114,7 +112,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
self.sender.emit(SIGNAL('mysignal(int,int)'), *self.args)
self.assertTrue(self.called)
-
def testSignalWithOneStringArgument(self):
QObject.connect(self.sender, SIGNAL("mysignal(QString)"),
self.forwarder, SIGNAL("mysignal(QString)"))
@@ -124,7 +121,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
self.sender.emit(SIGNAL('mysignal(QString)'), *self.args)
self.assertTrue(self.called)
-
def testSignalWithOneQObjectArgument(self):
QObject.connect(self.sender, SIGNAL('destroyed(QObject*)'),
self.forwarder, SIGNAL('forward(QObject*)'))
diff --git a/sources/pyside6/tests/signals/signal_autoconnect_test.py b/sources/pyside6/tests/signals/signal_autoconnect_test.py
index 3f12c8994..6c95aa74c 100644
--- a/sources/pyside6/tests/signals/signal_autoconnect_test.py
+++ b/sources/pyside6/tests/signals/signal_autoconnect_test.py
@@ -63,5 +63,6 @@ class AutoConnectionTest(unittest.TestCase):
btn.click()
self.assertTrue(win._method_called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_connectiontype_support_test.py b/sources/pyside6/tests/signals/signal_connectiontype_support_test.py
index e984492b6..23ad6a5c5 100644
--- a/sources/pyside6/tests/signals/signal_connectiontype_support_test.py
+++ b/sources/pyside6/tests/signals/signal_connectiontype_support_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, Qt
+
class Dummy(QObject):
"""Dummy class used in this test."""
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class TestConnectionTypeSupport(unittest.TestCase):
def callback(self, *args):
if tuple(self.args) == args:
diff --git a/sources/pyside6/tests/signals/signal_emission_gui_test.py b/sources/pyside6/tests/signals/signal_emission_gui_test.py
index f4aa7c856..c13a74e94 100644
--- a/sources/pyside6/tests/signals/signal_emission_gui_test.py
+++ b/sources/pyside6/tests/signals/signal_emission_gui_test.py
@@ -137,7 +137,7 @@ if hasQtGui:
spinSend.emit(SIGNAL('valueChanged(int)'), 3)
self.assertEqual(spinRec.value(), 3)
- #Direct emission shouldn't change the value of the emitter
+ # Direct emission shouldn't change the value of the emitter
self.assertEqual(spinSend.value(), 42)
spinSend.emit(SIGNAL('valueChanged(int)'), 66)
diff --git a/sources/pyside6/tests/signals/signal_emission_test.py b/sources/pyside6/tests/signals/signal_emission_test.py
index 550804c12..faca38ccc 100644
--- a/sources/pyside6/tests/signals/signal_emission_test.py
+++ b/sources/pyside6/tests/signals/signal_emission_test.py
@@ -63,10 +63,12 @@ class MoreArgsOnEmit(UsesQCoreApplication):
process = QProcess()
self.assertRaises(TypeError, process.emit, SIGNAL('finished(int)'), 55, 55)
+
class Dummy(QObject):
'''Dummy class'''
pass
+
class PythonSignalToCppSlots(UsesQCoreApplication):
'''Connect python signals to C++ slots'''
@@ -95,8 +97,9 @@ class PythonSignalToCppSlots(UsesQCoreApplication):
timeline, SLOT('setCurrentTime(int)'))
current = timeline.currentTime()
- dummy.emit(SIGNAL('dummy(int)'), current+42)
- self.assertEqual(timeline.currentTime(), current+42)
+ dummy.emit(SIGNAL('dummy(int)'), current + 42)
+ self.assertEqual(timeline.currentTime(), current + 42)
+
class CppSignalsToCppSlots(UsesQCoreApplication):
'''Connection between C++ slots and signals'''
@@ -121,11 +124,15 @@ class CppSignalsToCppSlots(UsesQCoreApplication):
else:
self.assertEqual(new_dir, QTimeLine.Forward)
+
called = False
+
+
def someSlot(args=None):
global called
called = True
+
class DynamicSignalsToFuncPartial(UsesQCoreApplication):
def testIt(self):
@@ -136,12 +143,14 @@ class DynamicSignalsToFuncPartial(UsesQCoreApplication):
o.emit(SIGNAL("ASignal()"))
self.assertTrue(called)
+
class EmitUnknownType(UsesQCoreApplication):
def testIt(self):
a = QObject()
- a.connect(SIGNAL('foobar(Dummy)'), lambda x: 42) # Just connect with an unknown type
+ a.connect(SIGNAL('foobar(Dummy)'), lambda x: 42) # Just connect with an unknown type
self.assertRaises(TypeError, a.emit, SIGNAL('foobar(Dummy)'), 22)
+
class EmitEnum(UsesQCoreApplication):
"""Test emission of enum arguments"""
@@ -155,5 +164,6 @@ class EmitEnum(UsesQCoreApplication):
p.stateChanged.emit(QProcess.NotRunning)
self.assertEqual(self.arg, QProcess.NotRunning)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_enum_test.py b/sources/pyside6/tests/signals/signal_enum_test.py
index d7e67052f..1a598270e 100644
--- a/sources/pyside6/tests/signals/signal_enum_test.py
+++ b/sources/pyside6/tests/signals/signal_enum_test.py
@@ -45,6 +45,7 @@ class Colors(Enum):
green = 2
blue = 3
+
class Obj(QObject):
enum_signal = Signal(Colors)
object_signal = Signal(object)
diff --git a/sources/pyside6/tests/signals/signal_func_test.py b/sources/pyside6/tests/signals/signal_func_test.py
index 7e8c8f762..cd37a69a9 100644
--- a/sources/pyside6/tests/signals/signal_func_test.py
+++ b/sources/pyside6/tests/signals/signal_func_test.py
@@ -39,18 +39,20 @@ init_test_paths(False)
from PySide6.QtCore import SIGNAL, SLOT
+
class SIGNALSLOTTests(unittest.TestCase):
'''Test the output of SIGNAL and SLOT.'''
def testSIGNAL(self):
- #SIGNAL function
+ # SIGNAL function
a = "foobar"
self.assertEqual(str(SIGNAL(a)), "2foobar")
def testSLOT(self):
- #SLOT function
+ # SLOT function
a = "foobar"
self.assertEqual(str(SLOT(a)), "1foobar")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_manager_refcount_test.py b/sources/pyside6/tests/signals/signal_manager_refcount_test.py
index 5bc1b30db..e304d01e3 100644
--- a/sources/pyside6/tests/signals/signal_manager_refcount_test.py
+++ b/sources/pyside6/tests/signals/signal_manager_refcount_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class SignalManagerRefCount(unittest.TestCase):
"""Simple test case to check if the signal_manager is erroneously incrementing the object refcounter"""
@@ -55,6 +56,7 @@ class SignalManagerRefCount(unittest.TestCase):
QObject.disconnect(obj, SIGNAL('destroyed()'), callback)
self.assertEqual(refcount, getrefcount(obj))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_number_limit_test.py b/sources/pyside6/tests/signals/signal_number_limit_test.py
index 6f54b73de..3534610a6 100644
--- a/sources/pyside6/tests/signals/signal_number_limit_test.py
+++ b/sources/pyside6/tests/signals/signal_number_limit_test.py
@@ -57,6 +57,7 @@ class Emitter(QObject):
s13 = Signal()
s14 = Signal()
+
class SignalNumberLimitTest(unittest.TestCase):
def myCb(self):
self._count += 1
@@ -95,5 +96,6 @@ class SignalNumberLimitTest(unittest.TestCase):
e.s14.emit()
self.assertEqual(self._count, 14)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_object_test.py b/sources/pyside6/tests/signals/signal_object_test.py
index 629a2e7f8..4df20f5d0 100644
--- a/sources/pyside6/tests/signals/signal_object_test.py
+++ b/sources/pyside6/tests/signals/signal_object_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QTimer, Signal, QObject, Slot, Qt
from helper.usesqcoreapplication import UsesQCoreApplication
+
class MyObject(QTimer):
sig1 = Signal()
sig2 = Signal(int, name='rangeChanged')
@@ -118,5 +119,6 @@ class SignalObjectTest(UsesQCoreApplication):
o.sig6.emit(arg)
self.assertEqual(arg, o._o)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_signature_test.py b/sources/pyside6/tests/signals/signal_signature_test.py
index 9aaa6c58b..5cf9fad61 100644
--- a/sources/pyside6/tests/signals/signal_signature_test.py
+++ b/sources/pyside6/tests/signals/signal_signature_test.py
@@ -45,9 +45,12 @@ from helper.usesqcoreapplication import UsesQCoreApplication
called = False
name = "Old"
+
+
class Obj(QObject):
dummySignalArgs = Signal(str)
numberSignal = Signal(int)
+
def __init__(self):
super().__init__()
self.signal = ''
@@ -65,11 +68,15 @@ class Obj(QObject):
global name
name = arg
+
def callback(arg=None):
pass
+
+
def callback_empty():
pass
+
class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
'''Test case for signal signature received by QObject::connectNotify().'''
@@ -103,7 +110,6 @@ class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
sender.emit(SIGNAL("dummySignal()"))
self.assertTrue(called)
-
def testStaticSlotArgs(self):
global name
sender = Obj()
diff --git a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py
index 993386985..dbf059a1d 100644
--- a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py
+++ b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py
@@ -60,6 +60,7 @@ class SignalPrimitiveTypeTest(unittest.TestCase):
self._app.exec_()
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/slot_reference_count_test.py b/sources/pyside6/tests/signals/slot_reference_count_test.py
index 419cf9fb3..757cd20cb 100644
--- a/sources/pyside6/tests/signals/slot_reference_count_test.py
+++ b/sources/pyside6/tests/signals/slot_reference_count_test.py
@@ -40,10 +40,12 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, SLOT
+
class Dummy(QObject):
def dispatch(self):
self.emit(SIGNAL('foo()'))
+
class PythonSignalRefCount(unittest.TestCase):
def setUp(self):
@@ -64,6 +66,7 @@ class PythonSignalRefCount(unittest.TestCase):
QObject.disconnect(self.emitter, SIGNAL('foo()'), cb)
self.assertEqual(getrefcount(cb), 2)
+
class CppSignalRefCount(unittest.TestCase):
def setUp(self):
@@ -84,5 +87,6 @@ class CppSignalRefCount(unittest.TestCase):
QObject.disconnect(self.emitter, SIGNAL('destroyed()'), cb)
self.assertEqual(getrefcount(cb), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/static_metaobject_test.py b/sources/pyside6/tests/signals/static_metaobject_test.py
index 280a8b49c..dbb3aecfa 100644
--- a/sources/pyside6/tests/signals/static_metaobject_test.py
+++ b/sources/pyside6/tests/signals/static_metaobject_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, Slot
from helper.usesqcoreapplication import UsesQCoreApplication
+
class MyObject(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -76,7 +77,6 @@ class StaticMetaObjectTest(UsesQCoreApplication):
# The SIGNAL was destroyed with old objects
self.assertEqual(o.metaObject().indexOfSignal("foo()"), -1)
-
def testSharedSignalEmission(self):
o = QObject()
m = MyObject()
@@ -89,5 +89,6 @@ class StaticMetaObjectTest(UsesQCoreApplication):
m.emit(SIGNAL("foo2()"))
self.assertEqual(m._slotCalledCount, 2)
+
if __name__ == '__main__':
unittest.main()