aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtCore
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/tests/QtCore')
-rw-r--r--sources/pyside6/tests/QtCore/blocking_signals_test.py22
-rw-r--r--sources/pyside6/tests/QtCore/bug_1019.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_1063.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_1069.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_1313.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_278_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_332.py7
-rw-r--r--sources/pyside6/tests/QtCore/bug_408.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_428.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_462.py16
-rw-r--r--sources/pyside6/tests/QtCore/bug_505.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_515.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_606.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_656.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_686.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_699.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_706.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_820.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_826.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_829.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_835.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_920.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_927.py20
-rw-r--r--sources/pyside6/tests/QtCore/bug_931.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_938.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_953.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_987.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_994.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_PYSIDE-164.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_PYSIDE-42.py1
-rw-r--r--sources/pyside6/tests/QtCore/child_event_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/classinfo_test.py21
-rw-r--r--sources/pyside6/tests/QtCore/deepcopy_test.py9
-rw-r--r--sources/pyside6/tests/QtCore/deletelater_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/destroysignal_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/duck_punching_test.py16
-rw-r--r--sources/pyside6/tests/QtCore/emoji_string_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/errormessages_with_features_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/hash_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/inherits_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/max_signals.py16
-rw-r--r--sources/pyside6/tests/QtCore/missing_symbols_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/mockclass_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/multiple_feature_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/python_conversion.py8
-rw-r--r--sources/pyside6/tests/QtCore/qabs_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qabstractitemmodel_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qanimationgroup_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qbitarray_test.py16
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_operator_test.py20
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_test.py10
-rw-r--r--sources/pyside6/tests/QtCore/qcalendar_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qcbor_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qcollator_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qcommandlineparser_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qcoreapplication_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qdatastream_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qdate_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qdatetime_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qeasingcurve_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qenum_test.py7
-rw-r--r--sources/pyside6/tests/QtCore/qevent_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qfile_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qfileinfo_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qfileread_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qflags_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qhandle_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qinstallmsghandler_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qlinef_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qlocale_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qlockfile_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qmetaobject_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qmimedatabase_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py19
-rw-r--r--sources/pyside6/tests/QtCore/qobject_children_segfault_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qobject_connect_notify_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qobject_destructor.py2
-rw-r--r--sources/pyside6/tests/QtCore/qobject_event_filter_test.py17
-rw-r--r--sources/pyside6/tests/QtCore/qobject_inherits_test.py17
-rw-r--r--sources/pyside6/tests/QtCore/qobject_objectproperty_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qobject_parent_test.py32
-rw-r--r--sources/pyside6/tests/QtCore/qobject_property_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qobject_protected_methods_test.py8
-rw-r--r--sources/pyside6/tests/QtCore/qobject_test.py12
-rw-r--r--sources/pyside6/tests/QtCore/qobject_timer_event_test.py9
-rw-r--r--sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qpoint_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/qprocess_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qproperty_decorator.py2
-rw-r--r--sources/pyside6/tests/QtCore/qrandomgenerator_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qrect_test.py17
-rw-r--r--sources/pyside6/tests/QtCore/qregularexpression_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/qresource_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qsettings_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qsize_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qslot_object_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qsrand_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qstandardpaths_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qstorageinfo_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qstring_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qsysinfo_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qtextstream_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qthread_prod_cons_test.py28
-rw-r--r--sources/pyside6/tests/QtCore/qthread_signal_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qthread_test.py15
-rw-r--r--sources/pyside6/tests/QtCore/qtimer_singleshot_test.py8
-rw-r--r--sources/pyside6/tests/QtCore/qtimer_timeout_test.py9
-rw-r--r--sources/pyside6/tests/QtCore/qtimezone_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qtnamespace_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qurl_test.py13
-rw-r--r--sources/pyside6/tests/QtCore/qurlquery_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/quuid_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qversionnumber_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/repr_test.py10
-rw-r--r--sources/pyside6/tests/QtCore/resources_mc.py3
-rw-r--r--sources/pyside6/tests/QtCore/setprop_on_ctor_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/snake_prop_feature_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/staticMetaObject_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/static_method_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/thread_signals_test.py10
-rw-r--r--sources/pyside6/tests/QtCore/tr_noop_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/translation_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/unaryoperator_test.py8
-rw-r--r--sources/pyside6/tests/QtCore/unicode_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/versioninfo_test.py1
130 files changed, 498 insertions, 200 deletions
diff --git a/sources/pyside6/tests/QtCore/blocking_signals_test.py b/sources/pyside6/tests/QtCore/blocking_signals_test.py
index 92382c1d4..b51ba2c7a 100644
--- a/sources/pyside6/tests/QtCore/blocking_signals_test.py
+++ b/sources/pyside6/tests/QtCore/blocking_signals_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, QFile, QSignalBlocker
+
class TestSignalsBlockedBasic(unittest.TestCase):
'''Basic test case for signalsBlocked'''
@@ -73,25 +74,25 @@ class TestSignalsBlocked(unittest.TestCase):
'''Test case to check if the signals are really blocked'''
def setUp(self):
- #Set up the basic resources needed
+ # Set up the basic resources needed
self.obj = QObject()
self.args = tuple()
self.called = False
def tearDown(self):
- #Delete used resources
+ # Delete used resources
del self.obj
del self.args
def callback(self, *args):
- #Default callback
- if args == self.args:
+ # Default callback
+ if args == self.args:
self.called = True
else:
raise TypeError("Invalid arguments")
def testShortCircuitSignals(self):
- #Blocking of Python short-circuit signals
+ # Blocking of Python short-circuit signals
QObject.connect(self.obj, SIGNAL('mysignal()'), self.callback)
self.obj.emit(SIGNAL('mysignal()'))
@@ -103,7 +104,7 @@ class TestSignalsBlocked(unittest.TestCase):
self.assertTrue(not self.called)
def testPythonSignals(self):
- #Blocking of Python typed signals
+ # Blocking of Python typed signals
QObject.connect(self.obj, SIGNAL('mysignal(int,int)'), self.callback)
self.args = (1, 3)
@@ -115,11 +116,12 @@ class TestSignalsBlocked(unittest.TestCase):
self.obj.emit(SIGNAL('mysignal(int,int)'), *self.args)
self.assertTrue(not self.called)
+
class TestQFileSignalBlocking(unittest.TestCase):
'''Test case for blocking the signal QIODevice.aboutToClose()'''
def setUp(self):
- #Set up the needed resources - A temp file and a QFile
+ # Set up the needed resources - A temp file and a QFile
self.called = False
handle, self.filename = mkstemp()
os.close(handle)
@@ -127,16 +129,16 @@ class TestQFileSignalBlocking(unittest.TestCase):
self.qfile = QFile(self.filename)
def tearDown(self):
- #Release acquired resources
+ # Release acquired resources
os.remove(self.filename)
del self.qfile
def callback(self):
- #Default callback
+ # Default callback
self.called = True
def testAboutToCloseBlocking(self):
- #QIODevice.aboutToClose() blocking
+ # QIODevice.aboutToClose() blocking
QObject.connect(self.qfile, SIGNAL('aboutToClose()'), self.callback)
diff --git a/sources/pyside6/tests/QtCore/bug_1019.py b/sources/pyside6/tests/QtCore/bug_1019.py
index c7f1ea358..f3a37f42c 100644
--- a/sources/pyside6/tests/QtCore/bug_1019.py
+++ b/sources/pyside6/tests/QtCore/bug_1019.py
@@ -47,6 +47,7 @@ class MyTimer (QTimer):
def slotUsedToIncreaseMethodOffset(self):
pass
+
class MyTimer2 (MyTimer):
@Slot()
@@ -57,6 +58,7 @@ class MyTimer2 (MyTimer):
self.startCalled = True
QCoreApplication.instance().quit()
+
class TestBug1019 (unittest.TestCase):
def testIt(self):
app = QCoreApplication([])
@@ -65,5 +67,6 @@ class TestBug1019 (unittest.TestCase):
app.exec_()
self.assertTrue(t.startCalled)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_1063.py b/sources/pyside6/tests/QtCore/bug_1063.py
index c92f4f191..e83886221 100644
--- a/sources/pyside6/tests/QtCore/bug_1063.py
+++ b/sources/pyside6/tests/QtCore/bug_1063.py
@@ -61,5 +61,6 @@ class QTextStreamTestCase(unittest.TestCase):
os.unlink(self.temp_file.name)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_1069.py b/sources/pyside6/tests/QtCore/bug_1069.py
index 505ebdb8f..ca99a408d 100644
--- a/sources/pyside6/tests/QtCore/bug_1069.py
+++ b/sources/pyside6/tests/QtCore/bug_1069.py
@@ -55,5 +55,6 @@ class QDataStreamOpOverloadTestCase(unittest.TestCase):
self.assertEqual(ok, True)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_1313.py b/sources/pyside6/tests/QtCore/bug_1313.py
index a80c81cc8..d384b44ba 100644
--- a/sources/pyside6/tests/QtCore/bug_1313.py
+++ b/sources/pyside6/tests/QtCore/bug_1313.py
@@ -67,7 +67,7 @@ def demo_generator():
my_qobject = MyQObject()
my_qobject.sig.connect(lambda: None)
return
- yield # to make it a generator
+ yield # to make it a generator
class GeneratorRaisesStopIterationTestCase(unittest.TestCase):
diff --git a/sources/pyside6/tests/QtCore/bug_278_test.py b/sources/pyside6/tests/QtCore/bug_278_test.py
index f4ce190b8..b130d2b03 100644
--- a/sources/pyside6/tests/QtCore/bug_278_test.py
+++ b/sources/pyside6/tests/QtCore/bug_278_test.py
@@ -44,6 +44,7 @@ def setValue(o):
values = ['Name']
o.setProperty('test1', values)
+
class QQtVersionTest(unittest.TestCase):
'''Tests for QVariant conversion of QStringList'''
@@ -53,7 +54,6 @@ class QQtVersionTest(unittest.TestCase):
self.assertEqual(o.property('test1'), ['Name'])
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_332.py b/sources/pyside6/tests/QtCore/bug_332.py
index 6b2e62db8..333f7fcdf 100644
--- a/sources/pyside6/tests/QtCore/bug_332.py
+++ b/sources/pyside6/tests/QtCore/bug_332.py
@@ -41,14 +41,15 @@ from PySide6.QtCore import QMutex
class Lock(QMutex):
- def tryLock(self,timeoutt=10):
- return QMutex.tryLock(self,timeoutt)
+ def tryLock(self, timeout=10):
+ return QMutex.tryLock(self, timeout)
+
class TestBug(unittest.TestCase):
def testCase(self):
l = Lock()
- l.tryLock() # this cause a assertion
+ l.tryLock() # this cause a assertion
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtCore/bug_408.py b/sources/pyside6/tests/QtCore/bug_408.py
index b5cd63c22..cb501bcfb 100644
--- a/sources/pyside6/tests/QtCore/bug_408.py
+++ b/sources/pyside6/tests/QtCore/bug_408.py
@@ -50,6 +50,7 @@ class MyDevice(QIODevice):
self.ptr += size
return retval
+
class QIODeviceTest(unittest.TestCase):
def testIt(self):
@@ -60,5 +61,6 @@ class QIODeviceTest(unittest.TestCase):
self.assertEqual(s.readLine(), "hello world")
self.assertEqual(s.readLine(), "hello again")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_428.py b/sources/pyside6/tests/QtCore/bug_428.py
index 7b4a730c0..184f7a30d 100644
--- a/sources/pyside6/tests/QtCore/bug_428.py
+++ b/sources/pyside6/tests/QtCore/bug_428.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class MyBaseObject(QObject):
def __init__(self, number):
self.myMember = 'myMember' + number
super().__init__()
+
class QObjectConstructorTest(unittest.TestCase):
def testBug(self):
for i in range(10):
@@ -49,5 +51,6 @@ class QObjectConstructorTest(unittest.TestCase):
obj = MyBaseObject(number)
self.assertEqual(obj.myMember, 'myMember' + number)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_462.py b/sources/pyside6/tests/QtCore/bug_462.py
index 6af2590ee..95772b9fd 100644
--- a/sources/pyside6/tests/QtCore/bug_462.py
+++ b/sources/pyside6/tests/QtCore/bug_462.py
@@ -37,21 +37,24 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, QEvent, QThread
+
class MyEvent(QEvent):
- def __init__(self,i):
+ def __init__(self, i):
print("TYPE:", type(QEvent.User))
- super().__init__(QEvent.Type(QEvent.User + 100 ))
+ super().__init__(QEvent.Type(QEvent.User + 100))
self.i = i
+
class MyThread (QThread):
- def __init__(self,owner):
+ def __init__(self, owner):
super().__init__()
- self.owner=owner;
+ self.owner = owner
def run(self):
for i in range(3):
- e=MyEvent(i);
- QCoreApplication.postEvent(self.owner,e)
+ e = MyEvent(i)
+ QCoreApplication.postEvent(self.owner, e)
+
class MyBaseObject(QObject):
def __init__(self):
@@ -76,5 +79,6 @@ class CheckForEventsTypes(unittest.TestCase):
self.assertTrue(isinstance(e, MyEvent))
o.app = None
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_505.py b/sources/pyside6/tests/QtCore/bug_505.py
index 5b3fba93d..a00973fea 100644
--- a/sources/pyside6/tests/QtCore/bug_505.py
+++ b/sources/pyside6/tests/QtCore/bug_505.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class MyBaseObject(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -46,6 +47,7 @@ class MyBaseObject(QObject):
if self.objectName() != "PySide":
raise NameError('Fail')
+
class CheckForEventsTypes(unittest.TestCase):
def testDelObject(self):
p = MyBaseObject()
@@ -53,5 +55,6 @@ class CheckForEventsTypes(unittest.TestCase):
del o
del p
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_515.py b/sources/pyside6/tests/QtCore/bug_515.py
index 917357f88..2e9ff83d6 100644
--- a/sources/pyside6/tests/QtCore/bug_515.py
+++ b/sources/pyside6/tests/QtCore/bug_515.py
@@ -42,14 +42,18 @@ from PySide6.QtCore import QCoreApplication, qAddPostRoutine
callCleanup = False
+
+
def _cleanup():
global callCleanup
callCleanup = True
+
def _checkCleanup():
global callCleanup
assert(callCleanup)
+
app = QCoreApplication([])
qAddPostRoutine(_cleanup)
qAddPostRoutine(_checkCleanup)
diff --git a/sources/pyside6/tests/QtCore/bug_606.py b/sources/pyside6/tests/QtCore/bug_606.py
index abe4ab2ca..f1245456c 100644
--- a/sources/pyside6/tests/QtCore/bug_606.py
+++ b/sources/pyside6/tests/QtCore/bug_606.py
@@ -40,6 +40,7 @@ from PySide6.QtCore import QPoint, QPointF
from PySide6.QtCore import QLine, QLineF
from PySide6.QtCore import QSize, QSizeF
+
class testCases(unittest.TestCase):
def testQPointToTuple(self):
p = QPoint(1, 2)
@@ -65,5 +66,6 @@ class testCases(unittest.TestCase):
s = QSizeF(1, 2)
self.assertEqual((1, 2), s.toTuple())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_656.py b/sources/pyside6/tests/QtCore/bug_656.py
index f0539c700..d58261dc2 100644
--- a/sources/pyside6/tests/QtCore/bug_656.py
+++ b/sources/pyside6/tests/QtCore/bug_656.py
@@ -39,9 +39,10 @@ from PySide6.QtCore import QCoreApplication
class CoreApp(QCoreApplication):
- def __init__(self,*args):
+ def __init__(self, *args):
super().__init__(*args)
# It shouldn't crash after the __init__ call
+
import sys
app = CoreApp(sys.argv)
diff --git a/sources/pyside6/tests/QtCore/bug_686.py b/sources/pyside6/tests/QtCore/bug_686.py
index ff9a64d50..e4c027ee1 100644
--- a/sources/pyside6/tests/QtCore/bug_686.py
+++ b/sources/pyside6/tests/QtCore/bug_686.py
@@ -53,6 +53,7 @@ class MyWriteThread(QThread):
self.lock.unlock()
self.canQuit = True
+
class MyReadThread(QThread):
def __init__(self, lock):
super().__init__()
@@ -67,6 +68,7 @@ class MyReadThread(QThread):
self.lock.unlock()
self.canQuit = True
+
class MyMutexedThread(QThread):
def __init__(self, mutex):
super().__init__()
@@ -81,6 +83,7 @@ class MyMutexedThread(QThread):
self.mutex.unlock()
self.canQuit = True
+
class TestQMutex (unittest.TestCase):
def testReadLocker(self):
@@ -122,5 +125,6 @@ class TestQMutex (unittest.TestCase):
thread.wait(2000)
self.assertTrue(thread.canQuit)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_699.py b/sources/pyside6/tests/QtCore/bug_699.py
index 2abfc0819..e624640d2 100644
--- a/sources/pyside6/tests/QtCore/bug_699.py
+++ b/sources/pyside6/tests/QtCore/bug_699.py
@@ -50,5 +50,6 @@ class TestBug699 (unittest.TestCase):
def testIt(self):
self.assertRaises(TypeError, self.defClass)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_706.py b/sources/pyside6/tests/QtCore/bug_706.py
index c9c961f57..813181726 100644
--- a/sources/pyside6/tests/QtCore/bug_706.py
+++ b/sources/pyside6/tests/QtCore/bug_706.py
@@ -39,9 +39,10 @@ from PySide6.QtCore import QAbstractListModel, QCoreApplication, QModelIndex
class MyModel (QAbstractListModel):
- def rowCount(self, parent = None):
+ def rowCount(self, parent=None):
return 3
+
class TestBug706(unittest.TestCase):
def mySlot(self, idx, start, end):
@@ -59,5 +60,6 @@ class TestBug706(unittest.TestCase):
self.assertEqual(self.start, 0)
self.assertEqual(self.end, 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_820.py b/sources/pyside6/tests/QtCore/bug_820.py
index 501dd9ce1..dfd6c6b63 100644
--- a/sources/pyside6/tests/QtCore/bug_820.py
+++ b/sources/pyside6/tests/QtCore/bug_820.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Slot, Signal, SIGNAL
+
def log_exception():
def log_exception_decorator(func):
@functools.wraps(func)
@@ -64,6 +65,7 @@ def log_exception2():
return log_exception_decorator
+
class MyObject(QObject):
def __init__(self, parent=None):
@@ -99,6 +101,7 @@ class SlotWithDecoratorTest(unittest.TestCase):
self.assertTrue(o._mySlotcalled)
self.assertTrue(o._mySlot2called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_826.py b/sources/pyside6/tests/QtCore/bug_826.py
index a6ef2667a..3b1fb3714 100644
--- a/sources/pyside6/tests/QtCore/bug_826.py
+++ b/sources/pyside6/tests/QtCore/bug_826.py
@@ -41,6 +41,7 @@ import PySide6
TEST_EVENT_TYPE = QEvent.Type(QEvent.registerEventType())
+
class TestEvent(QEvent):
TestEventType = QEvent.Type(QEvent.registerEventType())
@@ -61,5 +62,6 @@ class TestEnums(unittest.TestCase):
self.assertEqual(eval(repr(TestEvent.TestEventType)), TestEvent.TestEventType)
self.assertEqual(eval(repr(TEST_EVENT_TYPE)), TEST_EVENT_TYPE)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_829.py b/sources/pyside6/tests/QtCore/bug_829.py
index 54f461850..c5636f62a 100644
--- a/sources/pyside6/tests/QtCore/bug_829.py
+++ b/sources/pyside6/tests/QtCore/bug_829.py
@@ -69,5 +69,6 @@ class QVariantConversions(unittest.TestCase):
if self._confFileName is not None:
os.unlink(QDir.toNativeSeparators(self._confFileName))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_835.py b/sources/pyside6/tests/QtCore/bug_835.py
index 788ead4c9..e2217ed0c 100644
--- a/sources/pyside6/tests/QtCore/bug_835.py
+++ b/sources/pyside6/tests/QtCore/bug_835.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import QObject
get_counter = 0
set_counter = 0
+
class Descriptor(object):
def __get__(self, obj, owner):
global get_counter
@@ -57,10 +58,12 @@ class Descriptor(object):
set_counter += 1
obj.var = value
+
class FooBar(QObject):
test = Descriptor()
var = 0
+
class SetAndGetTestCases(unittest.TestCase):
def setUp(self):
global get_counter
@@ -97,5 +100,6 @@ class SetAndGetTestCases(unittest.TestCase):
get_counter = 0
set_counter = 0
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_920.py b/sources/pyside6/tests/QtCore/bug_920.py
index 7caea3810..e3e087c72 100644
--- a/sources/pyside6/tests/QtCore/bug_920.py
+++ b/sources/pyside6/tests/QtCore/bug_920.py
@@ -39,10 +39,12 @@ init_test_paths(False)
import PySide6.QtCore as QtCore
+
class Signaller(QtCore.QObject):
s1 = QtCore.Signal()
s2 = QtCore.Signal()
+
class TestBug920(unittest.TestCase):
def testIt(self):
diff --git a/sources/pyside6/tests/QtCore/bug_927.py b/sources/pyside6/tests/QtCore/bug_927.py
index 80f332979..1a9617481 100644
--- a/sources/pyside6/tests/QtCore/bug_927.py
+++ b/sources/pyside6/tests/QtCore/bug_927.py
@@ -38,22 +38,24 @@ init_test_paths(False)
from PySide6.QtCore import QTime, QRunnable, QThreadPool
+
class Task(QRunnable):
- def run(self):
- t = QTime()
- t.start()
- time.sleep(2) # Sleep 2 seconds
+ def run(self):
+ t = QTime()
+ t.start()
+ time.sleep(2) # Sleep 2 seconds
class QThreadPoolTest(unittest.TestCase):
'''This used to cause a segfault due the ownership control on globalInstance function '''
def testSlowJobs(self):
- for i in range(3):
- task = Task()
- QThreadPool.globalInstance().start(task)
- time.sleep(1) # Sleep 1 second
+ for i in range(3):
+ task = Task()
+ QThreadPool.globalInstance().start(task)
+ time.sleep(1) # Sleep 1 second
+
+ QThreadPool.globalInstance().waitForDone()
- QThreadPool.globalInstance().waitForDone()
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_931.py b/sources/pyside6/tests/QtCore/bug_931.py
index 1dcde427f..5f4f3b14c 100644
--- a/sources/pyside6/tests/QtCore/bug_931.py
+++ b/sources/pyside6/tests/QtCore/bug_931.py
@@ -37,9 +37,12 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal
o = QObject()
+
+
class MyObject(QObject):
s = Signal(int)
+
class CheckSignalType(unittest.TestCase):
def testSignal(self):
self.assertTrue(isinstance(QObject.destroyed, Signal))
@@ -52,5 +55,6 @@ class CheckSignalType(unittest.TestCase):
self.assertTrue(isinstance(MyObject.s, Signal))
self.assertFalse(isinstance(int, Signal))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_938.py b/sources/pyside6/tests/QtCore/bug_938.py
index 9965eec95..823a99e3b 100644
--- a/sources/pyside6/tests/QtCore/bug_938.py
+++ b/sources/pyside6/tests/QtCore/bug_938.py
@@ -47,5 +47,6 @@ class TestBug938 (unittest.TestCase):
b.close()
self.assertEqual(b.buffer().size(), 5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_953.py b/sources/pyside6/tests/QtCore/bug_953.py
index 25f2819e0..39f27cfe0 100644
--- a/sources/pyside6/tests/QtCore/bug_953.py
+++ b/sources/pyside6/tests/QtCore/bug_953.py
@@ -47,9 +47,10 @@ class Dispatcher(QObject):
QTimer.singleShot(0, self._finish)
def _finish(self):
- del self._me # It can't crash here!
+ del self._me # It can't crash here!
QTimer.singleShot(10, QCoreApplication.instance().quit)
+
if __name__ == '__main__':
app = QCoreApplication([])
Dispatcher()
diff --git a/sources/pyside6/tests/QtCore/bug_987.py b/sources/pyside6/tests/QtCore/bug_987.py
index d5a2bcd33..42d1f5fcf 100644
--- a/sources/pyside6/tests/QtCore/bug_987.py
+++ b/sources/pyside6/tests/QtCore/bug_987.py
@@ -46,5 +46,6 @@ class TestBug987(unittest.TestCase):
o = QObject()
self.assertRaises(RuntimeError, o.destroyed.disconnect, self.callback)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_994.py b/sources/pyside6/tests/QtCore/bug_994.py
index 1e1e137d8..adf41b2d3 100644
--- a/sources/pyside6/tests/QtCore/bug_994.py
+++ b/sources/pyside6/tests/QtCore/bug_994.py
@@ -40,7 +40,7 @@ from PySide6.QtCore import QIODevice, QTextStream
class MyIODevice (QIODevice):
def readData(self, amount):
- return bytes("\0a" * int(amount/2), "UTF-8")
+ return bytes("\0a" * int(amount / 2), "UTF-8")
def readLineData(self, maxSize):
return bytes("\0b" * 4, "UTF-8")
@@ -48,6 +48,7 @@ class MyIODevice (QIODevice):
def atEnd(self):
return False
+
class TestBug944 (unittest.TestCase):
def testIt(self):
@@ -57,5 +58,6 @@ class TestBug944 (unittest.TestCase):
self.assertEqual(s.read(4), "\0a\0a")
self.assertEqual(device.readLine(), "\0b\0b\0b\0b")
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py
index 826021215..36e9bd27d 100644
--- a/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py
+++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication, QEventLoop, QObject, Qt, QThread, QTimer, SIGNAL
+
class Emitter(QThread):
def __init__(self):
super().__init__()
@@ -46,6 +47,7 @@ class Emitter(QThread):
self.emit(SIGNAL("signal(int)"), 0)
print("After emit.")
+
class Receiver(QObject):
def __init__(self, eventloop):
super().__init__()
@@ -70,5 +72,6 @@ class TestBugPYSIDE164(unittest.TestCase):
emitter.wait(2000)
self.assertEqual(retval, 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py
index b2a79ea81..448312606 100644
--- a/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py
+++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py
@@ -49,5 +49,6 @@ class TestBugPYSIDE42 (unittest.TestCase):
self.assertNotEqual(hash1, hash2)
self.assertEqual(hash1, hash(obj1))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/child_event_test.py b/sources/pyside6/tests/QtCore/child_event_test.py
index e7d7756f1..29c51e2aa 100644
--- a/sources/pyside6/tests/QtCore/child_event_test.py
+++ b/sources/pyside6/tests/QtCore/child_event_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QTimer, QCoreApplication
from helper.usesqcoreapplication import UsesQCoreApplication
+
class ExtQObject(QObject):
def __init__(self):
super().__init__()
@@ -51,6 +52,7 @@ class ExtQObject(QObject):
QObject.childEvent(self, event)
self.child_event_received = True
+
class ExtQTimer(QTimer):
def __init__(self):
super().__init__()
@@ -82,6 +84,7 @@ class TestChildEvent(UsesQCoreApplication):
child.setParent(parent)
self.assertTrue(parent.child_event_received)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/classinfo_test.py b/sources/pyside6/tests/QtCore/classinfo_test.py
index e6a0a9256..7fed56bf7 100644
--- a/sources/pyside6/tests/QtCore/classinfo_test.py
+++ b/sources/pyside6/tests/QtCore/classinfo_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, ClassInfo
+
class TestClassInfo(unittest.TestCase):
def test_metadata(self):
@ClassInfo(author='pyside', url='http://www.pyside.org')
@@ -48,11 +49,11 @@ class TestClassInfo(unittest.TestCase):
mo = o.metaObject()
self.assertEqual(mo.classInfoCount(), 2)
- ci = mo.classInfo(0) #author
+ ci = mo.classInfo(0) # author
self.assertEqual(ci.name(), 'author')
self.assertEqual(ci.value(), 'pyside')
- ci = mo.classInfo(1) #url
+ ci = mo.classInfo(1) # url
self.assertEqual(ci.name(), 'url')
self.assertEqual(ci.value(), 'http://www.pyside.org')
@@ -93,20 +94,26 @@ class TestClassInfo(unittest.TestCase):
self.assertRaises(TypeError, decorator, MyObject2)
def test_can_only_be_used_on_qobjects(self):
- def test_function(): pass
+ def test_function():
+ pass
self.assertRaises(TypeError, ClassInfo(), test_function)
- class NotAQObject(object): pass
+ class NotAQObject(object):
+ pass
self.assertRaises(TypeError, ClassInfo(), NotAQObject)
- class QObjectSubclass(QObject): pass
+ class QObjectSubclass(QObject):
+ pass
ClassInfo()(QObjectSubclass)
- class SubclassOfNativeQObjectSubclass(QCoreApplication): pass
+ class SubclassOfNativeQObjectSubclass(QCoreApplication):
+ pass
ClassInfo()(SubclassOfNativeQObjectSubclass)
- class SubclassOfPythonQObjectSubclass(QObjectSubclass): pass
+ class SubclassOfPythonQObjectSubclass(QObjectSubclass):
+ pass
ClassInfo()(SubclassOfPythonQObjectSubclass)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/deepcopy_test.py b/sources/pyside6/tests/QtCore/deepcopy_test.py
index 711b023a9..ef9a72fb5 100644
--- a/sources/pyside6/tests/QtCore/deepcopy_test.py
+++ b/sources/pyside6/tests/QtCore/deepcopy_test.py
@@ -44,12 +44,14 @@ try:
except ImportError:
HAVE_Q = False
+
class DeepCopyHelper:
def testCopy(self):
copy = deepcopy([self.original])[0]
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class QByteArrayDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QByteArray(bytes('the quick brown fox jumps over the lazy dog', "UTF-8"))
@@ -89,30 +91,37 @@ class QRectFDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QRectF(100.33, 200.254, 300.321, 400.123)
+
class QLineDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLine(1, 2, 3, 4)
+
class QLineFDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLineF(1.1, 2.2, 3.3, 4.4)
+
class QPointDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPoint(1, 2)
+
class QPointFDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPointF(1.1, 2.2)
+
class QDirDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QDir("./")
+
class QUuiCopy(DeepCopyHelper, unittest.TestCase):
@unittest.skipUnless(HAVE_Q, "QUuid is currently not supported on this platform.")
def setUp(self):
self.original = QUuid("67C8770B-44F1-410A-AB9A-F9B5446F13EE")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/deletelater_test.py b/sources/pyside6/tests/QtCore/deletelater_test.py
index 1d8dff895..96927780d 100644
--- a/sources/pyside6/tests/QtCore/deletelater_test.py
+++ b/sources/pyside6/tests/QtCore/deletelater_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QTimer, QCoreApplication, SIGNAL
from helper.usesqcoreapplication import UsesQCoreApplication
+
class TestDeleteLater(UsesQCoreApplication):
'''Test case for function DeleteLater'''
@@ -52,6 +53,7 @@ class TestDeleteLater(UsesQCoreApplication):
QTimer.singleShot(100, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/destroysignal_test.py b/sources/pyside6/tests/QtCore/destroysignal_test.py
index fe91d5340..ff657a800 100644
--- a/sources/pyside6/tests/QtCore/destroysignal_test.py
+++ b/sources/pyside6/tests/QtCore/destroysignal_test.py
@@ -58,6 +58,7 @@ class TestDestroySignal(unittest.TestCase):
del p
self.assertTrue(self._destroyed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/duck_punching_test.py b/sources/pyside6/tests/QtCore/duck_punching_test.py
index b6421b256..ab682026b 100644
--- a/sources/pyside6/tests/QtCore/duck_punching_test.py
+++ b/sources/pyside6/tests/QtCore/duck_punching_test.py
@@ -43,32 +43,36 @@ init_test_paths(False)
from PySide6.QtCore import QObject
from helper.usesqcoreapplication import UsesQCoreApplication
+
def MethodType(func, instance, instanceType):
return types.MethodType(func, instance)
+
class Duck(QObject):
def __init__(self):
super().__init__()
+
def childEvent(self, event):
QObject.childEvent(self, event)
+
class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
'''Test case for duck punching new implementations of C++ virtual methods into object instances.'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.duck_childEvent_called = False
UsesQCoreApplication.setUp(self)
def tearDown(self):
- #Release resources
+ # Release resources
del self.duck_childEvent_called
UsesQCoreApplication.tearDown(self)
-
def testChildEventMonkeyPatch(self):
- #Test if the new childEvent injected on QObject instance is called from C++
+ # Test if the new childEvent injected on QObject instance is called from C++
parent = QObject()
+
def childEvent(obj, event):
self.duck_childEvent_called = True
parent.childEvent = MethodType(childEvent, parent, QObject)
@@ -83,8 +87,9 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
parent.childEvent = None
def testChildEventMonkeyPatchWithInheritance(self):
- #Test if the new childEvent injected on a QObject's extension class instance is called from C++
+ # Test if the new childEvent injected on a QObject's extension class instance is called from C++
parent = Duck()
+
def childEvent(obj, event):
QObject.childEvent(obj, event)
self.duck_childEvent_called = True
@@ -101,6 +106,7 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
# assert that checks if the wrapper mapper is empty.
parent.childEvent = None
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/emoji_string_test.py b/sources/pyside6/tests/QtCore/emoji_string_test.py
index 4efb05e57..1c9f6e1ec 100644
--- a/sources/pyside6/tests/QtCore/emoji_string_test.py
+++ b/sources/pyside6/tests/QtCore/emoji_string_test.py
@@ -64,6 +64,7 @@ from PySide6.QtCore import QObject, Signal
emoji_str = u'\U0001f632' + u' ' # "😲 "
+
class TestStuff(QObject):
testsig = Signal(str)
@@ -82,6 +83,7 @@ class TestStuff(QObject):
# https://stackoverflow.com/questions/30775689/python-length-of-unicode-string-confusion
assert len(emoji_str) == 2 if sys.maxunicode > 0xffff else 3
+
if __name__ == "__main__":
mything = TestStuff()
mything.plausi()
diff --git a/sources/pyside6/tests/QtCore/errormessages_with_features_test.py b/sources/pyside6/tests/QtCore/errormessages_with_features_test.py
index 05670373f..72452a588 100644
--- a/sources/pyside6/tests/QtCore/errormessages_with_features_test.py
+++ b/sources/pyside6/tests/QtCore/errormessages_with_features_test.py
@@ -60,6 +60,7 @@ This test is in its own file because combining it with
"snake_prop_feature_test" gave strange interactions with the other tests.
"""
+
class ErrormessagesWithFeatures(unittest.TestCase):
probe = "called with wrong argument types"
probe_miss = "missing signature"
diff --git a/sources/pyside6/tests/QtCore/hash_test.py b/sources/pyside6/tests/QtCore/hash_test.py
index 71fb9cde9..a6aab9270 100644
--- a/sources/pyside6/tests/QtCore/hash_test.py
+++ b/sources/pyside6/tests/QtCore/hash_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QDate, QDateTime, QTime, QUrl
from PySide6.QtCore import QLine, QPoint, QRect, QSize
+
class HashTest(unittest.TestCase):
def testInsert(self):
myHash = {}
@@ -89,6 +90,7 @@ class HashTest(unittest.TestCase):
self.assertEqual(l1, l2)
self.assertEqual(hash(l1), hash(l2))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/inherits_test.py b/sources/pyside6/tests/QtCore/inherits_test.py
index a176cbd44..2beea6c17 100644
--- a/sources/pyside6/tests/QtCore/inherits_test.py
+++ b/sources/pyside6/tests/QtCore/inherits_test.py
@@ -37,9 +37,11 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class MyObject(QObject):
pass
+
class MainTest(unittest.TestCase):
def testInherits(self):
o = MyObject()
@@ -47,5 +49,6 @@ class MainTest(unittest.TestCase):
self.assertEqual(mo.className(), 'MyObject')
self.assertTrue(o.inherits('MyObject'))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/max_signals.py b/sources/pyside6/tests/QtCore/max_signals.py
index 2122aa738..b5b5f00d8 100644
--- a/sources/pyside6/tests/QtCore/max_signals.py
+++ b/sources/pyside6/tests/QtCore/max_signals.py
@@ -37,33 +37,37 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class MyObject(QObject):
pass
class TestSignalLimitless(unittest.TestCase):
SIGNAL_MAX = 100
+
def test100DynamicSignals(self):
self.count = 0
+
def onSignal():
self.count += 1
- #create 100 dynamic signals
+ # create 100 dynamic signals
o = MyObject()
for i in range(self.SIGNAL_MAX):
- o.connect(SIGNAL('sig%d()'%i), onSignal)
+ o.connect(SIGNAL(f'sig{i}()'), onSignal)
- #chek if the signals are valid
+ # check if the signals are valid
m = o.metaObject()
for i in range(self.SIGNAL_MAX):
- self.assertTrue(m.indexOfSignal('sig%d()'%i) > 0)
+ self.assertTrue(m.indexOfSignal(f'sig{i}()') > 0)
- #emit all 100 signals
+ # emit all 100 signals
for i in range(self.SIGNAL_MAX):
- o.emit(SIGNAL('sig%d()'%i))
+ o.emit(SIGNAL(f'sig{i}()'))
self.assertEqual(self.count, self.SIGNAL_MAX)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/missing_symbols_test.py b/sources/pyside6/tests/QtCore/missing_symbols_test.py
index a0ad4749c..8e03edf9c 100644
--- a/sources/pyside6/tests/QtCore/missing_symbols_test.py
+++ b/sources/pyside6/tests/QtCore/missing_symbols_test.py
@@ -39,13 +39,15 @@ init_test_paths(False)
from PySide6 import QtCore
+
class MissingClasses(unittest.TestCase):
- def testQSettings(self): # Bug 232
+ def testQSettings(self): # Bug 232
getattr(QtCore, 'QSettings')
- def testQtTrNoop(self): # Bug 220
+ def testQtTrNoop(self): # Bug 220
getattr(QtCore, 'QT_TR_NOOP')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/mockclass_test.py b/sources/pyside6/tests/QtCore/mockclass_test.py
index 51d980e74..887de6bca 100644
--- a/sources/pyside6/tests/QtCore/mockclass_test.py
+++ b/sources/pyside6/tests/QtCore/mockclass_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication
+
class Mock(object):
def __init__(self):
self.called = False
@@ -58,6 +59,7 @@ class MockClassTest(unittest.TestCase):
QCoreApplication.instance()
self.assertTrue(mock.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/multiple_feature_test.py b/sources/pyside6/tests/QtCore/multiple_feature_test.py
index 8517bb70f..0a66075ae 100644
--- a/sources/pyside6/tests/QtCore/multiple_feature_test.py
+++ b/sources/pyside6/tests/QtCore/multiple_feature_test.py
@@ -62,6 +62,7 @@ There is much more to come.
MethodDescriptorType = type(str.split)
+
class FeaturesTest(unittest.TestCase):
def testAllFeatureCombinations(self):
diff --git a/sources/pyside6/tests/QtCore/python_conversion.py b/sources/pyside6/tests/QtCore/python_conversion.py
index 451a54bac..1e081bac2 100644
--- a/sources/pyside6/tests/QtCore/python_conversion.py
+++ b/sources/pyside6/tests/QtCore/python_conversion.py
@@ -43,6 +43,7 @@ import datetime
from PySide6.QtCore import QTime, QDateTime, QDate
+
class TestDateTimeConversions (unittest.TestCase):
def testQDate(self):
date = datetime.date(2010, 4, 23)
@@ -59,7 +60,7 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(time.hour, other.hour())
self.assertEqual(time.minute, other.minute())
self.assertEqual(time.second, other.second())
- self.assertEqual(time.microsecond/1000, other.msec())
+ self.assertEqual(time.microsecond / 1000, other.msec())
self.assertEqual(time, other.toPython())
@@ -76,7 +77,7 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(dateTime.hour, otherTime.hour())
self.assertEqual(dateTime.minute, otherTime.minute())
self.assertEqual(dateTime.second, otherTime.second())
- self.assertEqual(dateTime.microsecond/1000, otherTime.msec())
+ self.assertEqual(dateTime.microsecond / 1000, otherTime.msec())
self.assertEqual(dateTime, other.toPython())
@@ -93,9 +94,10 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(dateTime.hour, otherTime.hour())
self.assertEqual(dateTime.minute, otherTime.minute())
self.assertEqual(dateTime.second, otherTime.second())
- self.assertEqual(dateTime.microsecond/1000, otherTime.msec())
+ self.assertEqual(dateTime.microsecond / 1000, otherTime.msec())
self.assertEqual(dateTime, other.toPython())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qabs_test.py b/sources/pyside6/tests/QtCore/qabs_test.py
index 5dbcd6061..3320addb0 100644
--- a/sources/pyside6/tests/QtCore/qabs_test.py
+++ b/sources/pyside6/tests/QtCore/qabs_test.py
@@ -51,5 +51,6 @@ class QAbsTest(unittest.TestCase):
check(10.5)
check(-10.5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py b/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py
index ed0873917..bffad74ec 100644
--- a/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py
+++ b/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py
@@ -51,7 +51,7 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
def testInternalPointer(self):
m = MyModel()
foo = QObject()
- idx = m.createIndex(0,0, foo)
+ idx = m.createIndex(0, 0, foo)
check = m.checkIndex(idx, QAbstractItemModel.CheckIndexOption.IndexIsValid
| QAbstractItemModel.CheckIndexOption.DoNotUseParent
| QAbstractItemModel.CheckIndexOption.ParentIsInvalid)
@@ -73,6 +73,7 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
proxyData = str(proxyModel.data(proxyIndex, Qt.DisplayRole))
self.assertEqual(sourceData, proxyData)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qanimationgroup_test.py b/sources/pyside6/tests/QtCore/qanimationgroup_test.py
index 57def6cb3..0e623de17 100644
--- a/sources/pyside6/tests/QtCore/qanimationgroup_test.py
+++ b/sources/pyside6/tests/QtCore/qanimationgroup_test.py
@@ -53,10 +53,11 @@ class QAnimationGroupTest(unittest.TestCase):
panim.clear()
- self.assertRaises(RuntimeError, lambda :sanim.parent())
+ self.assertRaises(RuntimeError, lambda: sanim.parent())
QTimer.singleShot(100, app.quit)
app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qbitarray_test.py b/sources/pyside6/tests/QtCore/qbitarray_test.py
index 1fee4f69c..580fa1f5b 100644
--- a/sources/pyside6/tests/QtCore/qbitarray_test.py
+++ b/sources/pyside6/tests/QtCore/qbitarray_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QBitArray
+
def bool_list_from_qbitarray(qbitarray):
'''This function is used instead of a list comprehension because
the QBitArray is being tested also to check if it is providing
@@ -51,11 +52,12 @@ def bool_list_from_qbitarray(qbitarray):
qbitarray_values.append(qbitarray.at(i))
return qbitarray_values
+
class QBitArrayIsIterableTest(unittest.TestCase):
'''Tests if QBitArray class is iterable and also '~' (__invert__) and bitwise operators'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.qbitarray = QBitArray(3)
self.qbitarray_values = [True, False, False]
# WARNING: do not pythonify the following loop
@@ -71,7 +73,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.other_qbitarray.setBit(i, self.other_qbitarray_values[i])
def tearDown(self):
- #Release resources
+ # Release resources
del self.qbitarray
del self.other_qbitarray
del self.qbitarray_values
@@ -79,7 +81,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
del self.inverted_qbitarray_values
def testQBitArrayIsIterable(self):
- #Tests if QBitArray class is iterable
+ # Tests if QBitArray class is iterable
qbitarray_is_iterable = True
try:
bitarray = [bit for bit in self.qbitarray]
@@ -88,7 +90,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertTrue(qbitarray_is_iterable)
def testQBitArrayInvertOperator(self):
- #Tests QBitArray '~' (__invert__) operator
+ # Tests QBitArray '~' (__invert__) operator
inverted_qbitarray = ~self.qbitarray
# WARNING: do not pythonify the following loop, the
# iterability of QBitArray class is tested in another place
@@ -96,7 +98,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertEqual(self.inverted_qbitarray_values, inverted_qbitarray_values)
def testQBitArrayOrBitwiseOperator(self):
- #Tests QBitArray '|' (or) operator
+ # Tests QBitArray '|' (or) operator
has_or_bitwise_operator = True
ored_qbitarray, ored_bool_list = None, None
try:
@@ -108,7 +110,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertEqual(bool_list_from_qbitarray(ored_qbitarray), ored_bool_list)
def testQBitArrayAndBitwiseOperator(self):
- #Tests QBitArray '&' (and) operator
+ # Tests QBitArray '&' (and) operator
has_and_bitwise_operator = True
anded_qbitarray, anded_bool_list = None, None
try:
@@ -120,7 +122,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertEqual(bool_list_from_qbitarray(anded_qbitarray), anded_bool_list)
def testQBitArrayXorBitwiseOperator(self):
- #Tests QBitArray '^' (xor) operator
+ # Tests QBitArray '^' (xor) operator
has_xor_bitwise_operator = True
xored_qbitarray, xored_bool_list = None, None
try:
diff --git a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
index dcc3a059b..9fdfda64e 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
@@ -47,20 +47,21 @@ class QByteArrayConcatenationOperatorTest(unittest.TestCase):
'''Test cases for QByteArray concatenation with '+' operator'''
def testConcatQByteArrayAndPythonString(self):
- #Test concatenation of a QByteArray with a Python bytes, in this order
+ # Test concatenation of a QByteArray with a Python bytes, in this order
qba = QByteArray(bytes('foo', "UTF-8"))
result = qba + bytes('\x00bar', "UTF-8")
self.assertEqual(type(result), QByteArray)
self.assertEqual(result, bytes('foo\x00bar', "UTF-8"))
def testConcatPythonStringAndQByteArray(self):
- #Test concatenation of a Python bytes with a QByteArray, in this order
+ # Test concatenation of a Python bytes with a QByteArray, in this order
concat_python_string_add_qbytearray_worked = True
qba = QByteArray(bytes('foo', "UTF-8"))
result = bytes('bar\x00', "UTF-8") + qba
self.assertEqual(type(result), QByteArray)
self.assertEqual(result, bytes('bar\x00foo', "UTF-8"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py
index a65f76775..c7107872c 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py
@@ -58,7 +58,7 @@ class BaseQByteArrayOperatorIAdd(object):
def testString(self):
'''QByteArray += bytes of size > 1'''
s = bytearray(bytes('dummy', "UTF-8"))
- self.obj += s # XXx iadd support abytearray
+ self.obj += s # XXx iadd support abytearray
self.assertEqual(self.obj, self.orig_obj + s)
self.assertEqual(self.obj.size(), self.orig_obj.size() + len(s))
@@ -90,5 +90,6 @@ class ValidQByteArrayOperatorIAdd(unittest.TestCase, BaseQByteArrayOperatorIAdd)
self.obj = QByteArray(bytes('some byte array', "UTF-8"))
self.orig_obj = QByteArray(bytes('some byte array', "UTF-8"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qbytearray_operator_test.py b/sources/pyside6/tests/QtCore/qbytearray_operator_test.py
index 77678d199..0053b1351 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_operator_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_operator_test.py
@@ -42,30 +42,32 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray
+
class QByteArrayOperatorEqual(unittest.TestCase):
'''TestCase for operator QByteArray == QByteArray'''
def testDefault(self):
- #QByteArray() == QByteArray()
+ # QByteArray() == QByteArray()
obj1 = QByteArray()
obj2 = QByteArray()
self.assertEqual(obj1, obj2)
def testSimple(self):
- #QByteArray(some_string) == QByteArray(some_string)
+ # QByteArray(some_string) == QByteArray(some_string)
string = bytes('egg snakes', "UTF-8")
self.assertEqual(QByteArray(string), QByteArray(string))
def testPyString(self):
- #QByteArray(string) == string
+ # QByteArray(string) == string
string = bytes('my test string', "UTF-8")
self.assertEqual(QByteArray(string), string)
+
class QByteArrayOperatorAt(unittest.TestCase):
'''TestCase for operator QByteArray[]'''
def testInRange(self):
- #QByteArray[x] where x is a valid index
+ # QByteArray[x] where x is a valid index
string = 'abcdefgh'
obj = QByteArray(bytes(string, "UTF-8"))
@@ -73,25 +75,25 @@ class QByteArrayOperatorAt(unittest.TestCase):
self.assertEqual(obj[i], bytes(string[i], "UTF-8"))
def testInRangeReverse(self):
- #QByteArray[x] where x is a valid index (reverse order)
+ # QByteArray[x] where x is a valid index (reverse order)
string = 'abcdefgh'
obj = QByteArray(bytes(string, "UTF-8"))
- for i in range(len(string)-1, 0, -1):
+ for i in range(len(string) - 1, 0, -1):
self.assertEqual(obj[i], bytes(string[i], "UTF-8"))
-
def testOutOfRange(self):
- #QByteArray[x] where x is out of index
+ # QByteArray[x] where x is out of index
string = bytes('1234567', "UTF-8")
obj = QByteArray(string)
- self.assertRaises(IndexError, lambda :obj[len(string)])
+ self.assertRaises(IndexError, lambda: obj[len(string)])
def testNullStrings(self):
ba = QByteArray(bytes('\x00', "UTF-8"))
self.assertEqual(ba.at(0), '\x00')
self.assertEqual(ba[0], bytes('\x00', "UTF-8"))
+
class QByteArrayOperatorLen(unittest.TestCase):
'''Test case for __len__ operator of QByteArray'''
diff --git a/sources/pyside6/tests/QtCore/qbytearray_test.py b/sources/pyside6/tests/QtCore/qbytearray_test.py
index 69e608d98..c347a6e4d 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_test.py
@@ -45,6 +45,7 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray, QSettings, QObject, QDataStream, QIODevice
+
class QByteArrayTestToNumber(unittest.TestCase):
def testToNumberInt(self):
obj = QByteArray(bytes('37', "UTF8"))
@@ -95,10 +96,11 @@ class QByteArraySplit(unittest.TestCase):
'''Test case for QByteArray.split'''
def testPathSeparator(self):
- #QByteArray.split('/')
+ # QByteArray.split('/')
obj = QByteArray(bytes(unittest.__file__, "UTF8"))
self.assertEqual(obj.split('/'), unittest.__file__.split('/'))
+
class QByteArrayData(unittest.TestCase):
'''Test case for QByteArray.data'''
@@ -114,6 +116,7 @@ class QByteArrayData(unittest.TestCase):
self.assertEqual(s1, s2)
self.assertEqual(s1, ba)
+
class QByteArrayOperatorAtSetter(unittest.TestCase):
'''Test case for operator QByteArray[] - __setitem__'''
@@ -123,6 +126,7 @@ class QByteArrayOperatorAtSetter(unittest.TestCase):
obj[1] = bytes('0', "UTF8")
self.assertEqual(obj, QByteArray(bytes('103456', "UTF8")))
+
class QByteArrayOnQDataStream(unittest.TestCase):
'''
Bug PYSIDE-232
@@ -134,6 +138,7 @@ class QByteArrayOnQDataStream(unittest.TestCase):
# The __repr__ not suppose to crash anymore
self.assertNotEqual(repr(b), None)
+
class TestBug664(unittest.TestCase):
'''
QByteArray.data() should return correct data
@@ -148,6 +153,7 @@ class QByteArrayOnQVariant(unittest.TestCase):
a = QSettings().value("some_prop", QByteArray())
self.assertEqual(type(a), QByteArray)
+
class TestBug567(unittest.TestCase):
'''
QByteArray should support slices
@@ -171,12 +177,14 @@ class TestPickler(unittest.TestCase):
ba2 = pickle.loads(output)
self.assertEqual(str(ba), str(ba2))
+
class QByteArrayBug720(unittest.TestCase):
def testIt(self):
ba = QByteArray(bytes("32\"1\x00123", "UTF8"))
self.assertEqual(str(ba), str(bytes("32\"1\x00123", "UTF-8")))
self.assertEqual(repr(ba), "PySide6.QtCore.QByteArray(b'32\"1\\x00123')")
+
class QByteArrayImplicitConvert(unittest.TestCase):
def testString(self):
# No implicit conversions from QByteArray to python string
diff --git a/sources/pyside6/tests/QtCore/qcalendar_test.py b/sources/pyside6/tests/QtCore/qcalendar_test.py
index 0f9bfaf56..2c69a2026 100644
--- a/sources/pyside6/tests/QtCore/qcalendar_test.py
+++ b/sources/pyside6/tests/QtCore/qcalendar_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCalendar
+
class TestQCalendar (unittest.TestCase):
def testCalendar(self):
calendar = QCalendar(QCalendar.System.Gregorian)
diff --git a/sources/pyside6/tests/QtCore/qcbor_test.py b/sources/pyside6/tests/QtCore/qcbor_test.py
index 06ba2d4d1..0df9d9f95 100644
--- a/sources/pyside6/tests/QtCore/qcbor_test.py
+++ b/sources/pyside6/tests/QtCore/qcbor_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import (QByteArray, QCborStreamReader, QCborStreamWriter,
QCborValue)
+
class TestCbor(unittest.TestCase):
def testReader(self):
ba = QByteArray()
@@ -62,7 +63,7 @@ class TestCbor(unittest.TestCase):
self.assertTrue(not ba.isEmpty())
reader = QCborStreamReader(ba)
self.assertTrue(reader.hasNext())
- if (reader.isByteArray()): # Python 2
+ if (reader.isByteArray()): # Python 2
value = reader.readByteArray()
self.assertTrue(value)
self.assertEqual(value.data, "hello")
@@ -77,5 +78,6 @@ class TestCbor(unittest.TestCase):
self.assertTrue(value.isString())
self.assertEqual(value.toString(), 'hello')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcollator_test.py b/sources/pyside6/tests/QtCore/qcollator_test.py
index e5f2958d4..b9fc29658 100644
--- a/sources/pyside6/tests/QtCore/qcollator_test.py
+++ b/sources/pyside6/tests/QtCore/qcollator_test.py
@@ -64,5 +64,6 @@ class QCollatorTest(unittest.TestCase):
self.assertEqual(c.ignorePunctuation(), True)
self.assertEqual(c.locale(), QLocale(QLocale.NorwegianBokmal))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcommandlineparser_test.py b/sources/pyside6/tests/QtCore/qcommandlineparser_test.py
index 12250669a..8021aad74 100644
--- a/sources/pyside6/tests/QtCore/qcommandlineparser_test.py
+++ b/sources/pyside6/tests/QtCore/qcommandlineparser_test.py
@@ -59,5 +59,6 @@ class QCommandLineParserTest(unittest.TestCase):
self.assertEqual(parser2.values("b"), [])
self.assertEqual(parser2.positionalArguments(), [])
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py b/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py
index f3f4bfd8c..8e89a260e 100644
--- a/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py
+++ b/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py
@@ -42,15 +42,17 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication
+
class QCoreApplicationInstanceTest(unittest.TestCase):
'''Test cases for QCoreApplication.instance static method'''
def testQCoreApplicationInstance(self):
- #Tests QCoreApplication.instance()
+ # Tests QCoreApplication.instance()
self.assertEqual(QCoreApplication.instance(), None)
app = QCoreApplication([])
self.assertEqual(QCoreApplication.instance(), app)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcoreapplication_test.py b/sources/pyside6/tests/QtCore/qcoreapplication_test.py
index 8809c2a8e..30e000c31 100644
--- a/sources/pyside6/tests/QtCore/qcoreapplication_test.py
+++ b/sources/pyside6/tests/QtCore/qcoreapplication_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication
+
class TestQCoreApplication(unittest.TestCase):
def testNoArguments(self):
app = QCoreApplication()
diff --git a/sources/pyside6/tests/QtCore/qdatastream_test.py b/sources/pyside6/tests/QtCore/qdatastream_test.py
index fd1dcfd46..cd0e3e0cb 100644
--- a/sources/pyside6/tests/QtCore/qdatastream_test.py
+++ b/sources/pyside6/tests/QtCore/qdatastream_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QBitArray, QByteArray, QIODevice, QDataStream, QDate, QTime, QDateTime
+
def create_bitarray(string):
array = QBitArray(len(string))
for i, char in enumerate(string):
@@ -109,6 +110,7 @@ class QDataStreamWrite(unittest.TestCase):
y = int(self.read.readUInt32())
self.assertEqual(x, y)
+
class QDataStreamShift(unittest.TestCase):
'''Test case for << and >> operators'''
@@ -223,7 +225,6 @@ class QDataStreamShift(unittest.TestCase):
self.assertTrue(res.isValid())
self.assertFalse(res.isNull())
-
def testQTimeNull(self):
'''QDataStream <<>> QTime - null'''
self.stream << QTime()
@@ -320,6 +321,7 @@ class QDataStreamRawData(unittest.TestCase):
data = QDataStream(ba)
self.assertEqual(data.readRawData(4), bytes('AB\x00C', "UTF-8"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qdate_test.py b/sources/pyside6/tests/QtCore/qdate_test.py
index 2946dc9b4..b5259163a 100644
--- a/sources/pyside6/tests/QtCore/qdate_test.py
+++ b/sources/pyside6/tests/QtCore/qdate_test.py
@@ -66,5 +66,6 @@ class TestQDate (unittest.TestCase):
nodate = QDate()
self.assertFalse(nodate)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qdatetime_test.py b/sources/pyside6/tests/QtCore/qdatetime_test.py
index 5342f40b0..362b1fb4c 100644
--- a/sources/pyside6/tests/QtCore/qdatetime_test.py
+++ b/sources/pyside6/tests/QtCore/qdatetime_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QDateTime, QDate, QTime
+
class TestQDate (unittest.TestCase):
def testDateConversion(self):
dateTime = QDateTime(QDate(2011, 5, 17), QTime(11, 1, 14, 15))
@@ -54,5 +55,6 @@ class TestQDate (unittest.TestCase):
qt = QDateTime(py)
self.assertEqual(qt, py)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qeasingcurve_test.py b/sources/pyside6/tests/QtCore/qeasingcurve_test.py
index 4966b207c..46f8f5b90 100644
--- a/sources/pyside6/tests/QtCore/qeasingcurve_test.py
+++ b/sources/pyside6/tests/QtCore/qeasingcurve_test.py
@@ -37,12 +37,14 @@ init_test_paths(False)
from PySide6.QtCore import QEasingCurve
+
def myFunction(progress):
if progress == 1.0:
return 100.0
else:
return -100.0
+
class TestQEasingCurve(unittest.TestCase):
def testCustomType(self):
ec = QEasingCurve()
@@ -57,5 +59,6 @@ class TestQEasingCurve(unittest.TestCase):
self.assertEqual(ec.valueForProgress(1.0), 100.0)
self.assertEqual(ec.valueForProgress(0.5), -100.0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qenum_test.py b/sources/pyside6/tests/QtCore/qenum_test.py
index 146773094..0d524505a 100644
--- a/sources/pyside6/tests/QtCore/qenum_test.py
+++ b/sources/pyside6/tests/QtCore/qenum_test.py
@@ -142,6 +142,7 @@ class TestEnumPickling(unittest.TestCase):
# PYSIDE-957: The QEnum macro
+
try:
import enum
HAVE_ENUM = True
@@ -149,7 +150,9 @@ except ImportError:
HAVE_ENUM = False
QEnum = QFlag = lambda x: x
import types
- class Enum: pass
+
+ class Enum:
+ pass
enum = types.ModuleType("enum")
enum.Enum = enum.Flag = enum.IntEnum = enum.IntFlag = Enum
Enum.__module__ = "enum"
@@ -159,11 +162,13 @@ except ImportError:
HAVE_FLAG = hasattr(enum, "Flag")
+
@QEnum
class OuterEnum(enum.Enum):
A = 1
B = 2
+
class SomeClass(QObject):
@QEnum
diff --git a/sources/pyside6/tests/QtCore/qevent_test.py b/sources/pyside6/tests/QtCore/qevent_test.py
index 8251c5814..2d7aff03f 100644
--- a/sources/pyside6/tests/QtCore/qevent_test.py
+++ b/sources/pyside6/tests/QtCore/qevent_test.py
@@ -41,11 +41,12 @@ init_test_paths(False)
from PySide6.QtCore import QEvent
+
class QEventTypeFlag(unittest.TestCase):
'''Test case for usage of QEvent.Type flags'''
def testFlagAccess(self):
- #QEvent.Type flags usage
+ # QEvent.Type flags usage
event = QEvent(QEvent.Timer)
self.assertEqual(event.type(), QEvent.Timer)
@@ -56,5 +57,6 @@ class QEventTypeFlag(unittest.TestCase):
event = QEvent(QEvent.IconTextChange)
self.assertEqual(event.type(), QEvent.IconTextChange)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qfile_test.py b/sources/pyside6/tests/QtCore/qfile_test.py
index d00ac72a7..897b4583c 100644
--- a/sources/pyside6/tests/QtCore/qfile_test.py
+++ b/sources/pyside6/tests/QtCore/qfile_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QDir, QFile, QIODevice, QSaveFile, QTemporaryDir
+
class GetCharTest(unittest.TestCase):
'''Test case for QIODevice.getChar in QFile'''
@@ -84,5 +85,6 @@ class GetCharTest(unittest.TestCase):
self.assertTrue(saveFile.commit())
self.assertTrue(os.path.exists(QDir.toNativeSeparators(saveFile.fileName())))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qfileinfo_test.py b/sources/pyside6/tests/QtCore/qfileinfo_test.py
index 3049a8fc1..bbdd4bce9 100644
--- a/sources/pyside6/tests/QtCore/qfileinfo_test.py
+++ b/sources/pyside6/tests/QtCore/qfileinfo_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QFile, QFileInfo
+
class QFileConstructor(unittest.TestCase):
'''QFileInfo constructor with qfile'''
@@ -45,5 +46,6 @@ class QFileConstructor(unittest.TestCase):
'''QFileInfo(QFile)'''
obj = QFileInfo(QFile())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qfileread_test.py b/sources/pyside6/tests/QtCore/qfileread_test.py
index 0e4e670e5..98b27896c 100644
--- a/sources/pyside6/tests/QtCore/qfileread_test.py
+++ b/sources/pyside6/tests/QtCore/qfileread_test.py
@@ -41,12 +41,15 @@ from PySide6.QtCore import QIODevice, QTemporaryFile
class FileChild1(QTemporaryFile):
pass
+
class FileChild2(QTemporaryFile):
def readData(self, maxlen):
return super(FileChild2, self).readData(maxlen)
+
def readLineData(self, maxlen):
return super(FileChild2, self).readLineData(maxlen)
+
class readDataTest(unittest.TestCase):
'''Test case for readData and readLineData'''
@@ -70,7 +73,6 @@ class readDataTest(unittest.TestCase):
s1 = self.filename1.read(50)
self.assertEqual(s1, 'Test text for testing')
-
def testBug40(self):
self.filename2.seek(0)
s2 = self.filename2.read(50)
@@ -84,5 +86,6 @@ class readDataTest(unittest.TestCase):
s1 = self.filename1.read(50)
self.assertEqual(s1, s2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qflags_test.py b/sources/pyside6/tests/QtCore/qflags_test.py
index 4b368681f..bde6abde1 100644
--- a/sources/pyside6/tests/QtCore/qflags_test.py
+++ b/sources/pyside6/tests/QtCore/qflags_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import Qt, QTemporaryFile, QFile, QIODevice, QObject
+
class QFlagTest(unittest.TestCase):
'''Test case for usage of flags'''
@@ -110,12 +111,14 @@ class QFlagOperatorTest(unittest.TestCase):
flags = Qt.NoItemFlags | Qt.ItemIsUserCheckable
self.assertEqual(flags | Qt.ItemIsEnabled, Qt.ItemIsEnabled | flags)
+
class QFlagsOnQVariant(unittest.TestCase):
def testQFlagsOnQVariant(self):
o = QObject()
o.setProperty("foo", QIODevice.ReadOnly | QIODevice.WriteOnly)
self.assertEqual(type(o.property("foo")), QIODevice.OpenMode)
+
class QFlagsWrongType(unittest.TestCase):
def testWrongType(self):
'''Wrong type passed to QFlags binary operators'''
diff --git a/sources/pyside6/tests/QtCore/qhandle_test.py b/sources/pyside6/tests/QtCore/qhandle_test.py
index 08e53633c..9f6708787 100644
--- a/sources/pyside6/tests/QtCore/qhandle_test.py
+++ b/sources/pyside6/tests/QtCore/qhandle_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QThread, Qt
+
class TestHANDLE(unittest.TestCase):
def testIntConversion(self):
i = 0
@@ -48,5 +49,6 @@ class TestHANDLE(unittest.TestCase):
i = 0 + int(h)
self.assertEqual(i, int(h))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
index 3f8e11a4b..7043ec7d7 100644
--- a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
+++ b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
@@ -43,13 +43,16 @@ from PySide6.QtCore import (QLibraryInfo, QtCriticalMsg, QtDebugMsg, QtWarningMs
param = []
+
def handler(msgt, ctx, msg):
global param
param = [msgt, ctx, msg.strip()]
+
def handleruseless(msgt, ctx, msg):
pass
+
class QInstallMsgHandlerTest(unittest.TestCase):
def tearDown(self):
@@ -84,6 +87,7 @@ class QInstallMsgHandlerTest(unittest.TestCase):
self.assertEqual(param[0], QtCriticalMsg)
self.assertEqual(param[2], "Test Critical")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qlinef_test.py b/sources/pyside6/tests/QtCore/qlinef_test.py
index cd278f5f9..0a2e91a82 100644
--- a/sources/pyside6/tests/QtCore/qlinef_test.py
+++ b/sources/pyside6/tests/QtCore/qlinef_test.py
@@ -52,5 +52,6 @@ class TestQLineF (unittest.TestCase):
self.assertEqual(QLineF.BoundedIntersection, value)
self.assertEqual(QPointF(1, 0), p)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qlocale_test.py b/sources/pyside6/tests/QtCore/qlocale_test.py
index d2ba4bf5e..0e1603846 100644
--- a/sources/pyside6/tests/QtCore/qlocale_test.py
+++ b/sources/pyside6/tests/QtCore/qlocale_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QLocale
+
class QLocaleTestToNumber(unittest.TestCase):
def testToNumberInt(self):
obj = QLocale(QLocale.C)
@@ -71,5 +72,6 @@ class QLocaleTestToNumber(unittest.TestCase):
obj = QLocale(QLocale.C)
self.assertTrue(not obj.toULongLong('-37')[1])
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qlockfile_test.py b/sources/pyside6/tests/QtCore/qlockfile_test.py
index 2508b3f7b..f773c7112 100644
--- a/sources/pyside6/tests/QtCore/qlockfile_test.py
+++ b/sources/pyside6/tests/QtCore/qlockfile_test.py
@@ -42,6 +42,7 @@ init_test_paths()
from PySide6.QtCore import QDir, QLockFile, QCoreApplication
+
class TestQMessageAuthenticationCode (unittest.TestCase):
def setUp(self):
@@ -59,5 +60,6 @@ class TestQMessageAuthenticationCode (unittest.TestCase):
self.assertTrue(lockFile.isLocked())
lockFile.unlock()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py b/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py
index d312fe412..89e3d7ba1 100644
--- a/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py
+++ b/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCryptographicHash, QMessageAuthenticationCode
+
class TestQMessageAuthenticationCode (unittest.TestCase):
def test(self):
code = QMessageAuthenticationCode(QCryptographicHash.Sha1, bytes('bla', "UTF-8"))
@@ -48,5 +49,6 @@ class TestQMessageAuthenticationCode (unittest.TestCase):
self.assertTrue(result.size() > 0)
print(result.toHex())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmetaobject_test.py b/sources/pyside6/tests/QtCore/qmetaobject_test.py
index abff32037..33c35595f 100644
--- a/sources/pyside6/tests/QtCore/qmetaobject_test.py
+++ b/sources/pyside6/tests/QtCore/qmetaobject_test.py
@@ -44,12 +44,14 @@ from PySide6.QtCore import QFile, QObject, QTimer, SIGNAL
class Foo(QFile):
- pass
+ pass
+
class DynObject(QObject):
def slot(self):
pass
+
class qmetaobject_test(unittest.TestCase):
"""
def test_QMetaObject(self):
@@ -93,6 +95,7 @@ class qmetaobject_test(unittest.TestCase):
self.assertEqual(timer.metaObject().superClass().className(),
"QObject")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmimedatabase_test.py b/sources/pyside6/tests/QtCore/qmimedatabase_test.py
index ee16142e0..099f9e10e 100644
--- a/sources/pyside6/tests/QtCore/qmimedatabase_test.py
+++ b/sources/pyside6/tests/QtCore/qmimedatabase_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QMimeDatabase, QLocale
+
class QMimeDatabaseTest(unittest.TestCase):
def testMimeTypeForName(self):
db = QMimeDatabase()
@@ -81,5 +82,6 @@ class QMimeDatabaseTest(unittest.TestCase):
doesNotExist = db.mimeTypeForName("foobar/x-doesnot-exist")
self.assertTrue(not doesNotExist.isValid())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
index 953c57c77..70ca5b9a6 100644
--- a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
+++ b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
@@ -45,41 +45,42 @@ from PySide6.QtCore import QAbstractListModel, QObject
class MyModel (QAbstractListModel):
pass
+
class TestQModelIndexInternalPointer(unittest.TestCase):
''' Test case for QAbstractListModel.createIndex and QModelIndex.internalPointer'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.model = MyModel()
def tearDown(self):
- #Release resources
+ # Release resources
del self.model
def testInternalPointer(self):
- #Test QAbstractListModel.createIndex and
- #QModelIndex.internalPointer with regular Python objects
+ # Test QAbstractListModel.createIndex and
+ # QModelIndex.internalPointer with regular Python objects
obj = QObject()
idx = self.model.createIndex(0, 0, "Hello")
i = idx.internalPointer()
self.assertEqual(i, "Hello")
def testReferenceCounting(self):
- #Test reference counting when retrieving data with
- #QModelIndex.internalPointer
+ # Test reference counting when retrieving data with
+ # QModelIndex.internalPointer
o = [1, 2, 3]
o_refcnt = sys.getrefcount(o)
idx = self.model.createIndex(0, 0, o)
ptr = idx.internalPointer()
self.assertEqual(sys.getrefcount(o), o_refcnt + 1)
-
def testIndexForDefaultDataArg(self):
- #Test QAbstractListModel.createIndex with a default
- #value for data argument
+ # Test QAbstractListModel.createIndex with a default
+ # value for data argument
idx = self.model.createIndex(0, 0)
self.assertEqual(None, idx.internalPointer())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
index f1d7fff1c..cab045ddc 100644
--- a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
@@ -39,11 +39,12 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication
+
class ChildrenCoreApplication(unittest.TestCase):
'''Test case for calling QObject.children after creating a QCoreApp'''
def testQCoreAppChildren(self):
- #QObject.children() after creating a QCoreApplication
+ # QObject.children() after creating a QCoreApplication
# Minimal test:
# 1- Create QCoreApp
# 2- Create parent and childrens
@@ -55,7 +56,7 @@ class ChildrenCoreApplication(unittest.TestCase):
# Uncomment the lines below to make the test pass
# del children
# del child2
- del parent # XXX Segfaults here
+ del parent # XXX Segfaults here
self.assertTrue(True)
diff --git a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py
index 794eddd13..a5b44a2a1 100644
--- a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py
@@ -46,6 +46,7 @@ from helper.usesqcoreapplication import UsesQCoreApplication
def cute_slot():
pass
+
class Obj(QObject):
def __init__(self):
super().__init__()
@@ -64,6 +65,7 @@ class Obj(QObject):
self.con_notified = False
self.dis_notified = False
+
class TestQObjectConnectNotify(UsesQCoreApplication):
'''Test case for QObject::connectNotify'''
def setUp(self):
@@ -109,5 +111,6 @@ class TestQObjectConnectNotify(UsesQCoreApplication):
sender.disconnect(SIGNAL("foo()"), cute_slot)
self.assertTrue(sender.dis_notified)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_destructor.py b/sources/pyside6/tests/QtCore/qobject_destructor.py
index 2354cdfa7..d24017397 100644
--- a/sources/pyside6/tests/QtCore/qobject_destructor.py
+++ b/sources/pyside6/tests/QtCore/qobject_destructor.py
@@ -43,6 +43,7 @@ class MyObject(QObject):
super().__init__(None)
self._o = other
+
class TestDestructor(unittest.TestCase):
def testReference(self):
o = QObject()
@@ -51,5 +52,6 @@ class TestDestructor(unittest.TestCase):
del m
self.assertEqual(sys.getrefcount(o), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
index 112f21103..c45ba1c73 100644
--- a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
@@ -42,10 +42,11 @@ from PySide6.QtCore import QObject, QTimerEvent
from helper.usesqcoreapplication import UsesQCoreApplication
+
class FilterObject(QObject):
'''Filter object for the basic test'''
def __init__(self, obj=None, event_type=None, *args):
- #Creates a new filter object
+ # Creates a new filter object
QObject.__init__(self, *args)
self.obj = obj
self.event_type = event_type
@@ -53,7 +54,7 @@ class FilterObject(QObject):
self.events_bypassed = 0
def setTargetObject(self, obj):
- #Sets the object that will be filtered
+ # Sets the object that will be filtered
self.obj = obj
def eventFilter(self, obj, event):
@@ -70,6 +71,7 @@ class FilterObject(QObject):
else:
return QObject.eventFilter(self, obj, event)
+
class FilteredObject(QObject):
'''Class that will be filtered. Quits the app after 5 timer events'''
def __init__(self, app, *args):
@@ -78,28 +80,30 @@ class FilteredObject(QObject):
self.times_called = 0
def timerEvent(self, evt):
- #Overriden method
+ # Overridden method
self.times_called += 1
if self.times_called == 5:
self.app.quit()
+
class TestQObjectEventFilterPython(UsesQCoreApplication):
'''QObject.eventFilter - Reimplemented in python
Filters 5 TimerEvents and then bypasses the other events to the
timerEvent method. After 5 runs, the timerEvent method will ask
the core application to exit'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
UsesQCoreApplication.setUp(self)
self.obj_filter = FilterObject(event_type=QTimerEvent)
+
def tearDown(self):
- #Release resources
+ # Release resources
del self.obj_filter
UsesQCoreApplication.tearDown(self)
def testEventFilter(self):
- #QObject.eventFilter reimplemented in python
+ # QObject.eventFilter reimplemented in python
filtered = FilteredObject(self.app)
filtered.installEventFilter(self.obj_filter)
self.obj_filter.setTargetObject(filtered)
@@ -145,5 +149,6 @@ class TestQObjectEventFilterPython(UsesQCoreApplication):
del obj
self.assertEqual(wref(), None)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_inherits_test.py b/sources/pyside6/tests/QtCore/qobject_inherits_test.py
index 252b3e024..3246f0b77 100644
--- a/sources/pyside6/tests/QtCore/qobject_inherits_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_inherits_test.py
@@ -42,19 +42,20 @@ from PySide6.QtWidgets import QApplication, QLabel, QVBoxLayout
is_alive = None
+
class InheritsCase(unittest.TestCase):
'''Test case for QObject.inherits'''
def testCppInheritance(self):
- #QObject.inherits() for c++ classes
- #An class inherits itself
+ # QObject.inherits() for c++ classes
+ # A class inherits itself
self.assertTrue(QObject().inherits('QObject'))
def testPythonInheritance(self):
- #QObject.inherits() for python classes
+ # QObject.inherits() for python classes
class Dummy(QObject):
- #Dummy class
+ # Dummy class
pass
self.assertTrue(Dummy().inherits('QObject'))
@@ -62,15 +63,16 @@ class InheritsCase(unittest.TestCase):
self.assertTrue(not Dummy().inherits('FooBar'))
def testPythonMultiInheritance(self):
- #QObject.inherits() for multiple inheritance
+ # QObject.inherits() for multiple inheritance
# QObject.inherits(classname) should fail if classname isn't a
# QObject subclass
class Parent(object):
- #Dummy parent
+ # Dummy parent
pass
+
class Dummy(QObject, Parent):
- #Dummy class
+ # Dummy class
pass
self.assertTrue(Dummy().inherits('QObject'))
@@ -108,6 +110,7 @@ class InheritsCase(unittest.TestCase):
# is null under the pythonTypeIsValueType() method in shiboken.
def testDeleteMultipleInheritance(self):
app = QApplication(sys.argv)
+
class DerivedLabel(QLabel, QObject):
def __del__(self):
global is_alive
diff --git a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
index f799a96d0..9143355f2 100644
--- a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
@@ -44,6 +44,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class ExtQObject(QObject):
def __init__(self):
# "foobar" will become a object attribute that will not be
@@ -55,12 +56,14 @@ class ExtQObject(QObject):
# definition of "self.foobar".
super().__init__()
+
class TestBug378(unittest.TestCase):
'''Test case for the bug #378'''
def testBug378(self):
obj = ExtQObject()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_parent_test.py b/sources/pyside6/tests/QtCore/qobject_parent_test.py
index 0cef3d326..972d4f6fa 100644
--- a/sources/pyside6/tests/QtCore/qobject_parent_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_parent_test.py
@@ -45,17 +45,17 @@ class ParentRefCountCase(unittest.TestCase):
'''Test case for the refcount changes of setParent'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.parent = QObject()
self.child = QObject()
def tearDown(self):
- #Release resources
+ # Release resources
del self.child
del self.parent
def testSetParent(self):
- #QObject.setParent() refcount changes
+ # QObject.setParent() refcount changes
self.assertEqual(getrefcount(self.child), 2)
self.child.setParent(self.parent)
self.assertEqual(getrefcount(self.child), 3)
@@ -68,15 +68,16 @@ class ParentRefCountCase(unittest.TestCase):
self.assertEqual(getrefcount(self.child), 3)
def testConstructor(self):
- #QObject(QObject) refcount changes
+ # QObject(QObject) refcount changes
child = QObject(self.parent)
self.assertEqual(getrefcount(child), 3)
+
class ParentCase(unittest.TestCase):
'''Small collection of tests related to parent-child relationship'''
def testSetParent(self):
- #QObject.setParent()
+ # QObject.setParent()
parent = QObject()
child = QObject()
child.setParent(parent)
@@ -84,7 +85,7 @@ class ParentCase(unittest.TestCase):
self.assertEqual(parent, child.parent())
def testParentConstructor(self):
- #QObject(parent)
+ # QObject(parent)
parent = QObject()
child = QObject(parent)
@@ -95,14 +96,14 @@ class ParentCase(unittest.TestCase):
self.assertEqual(orig_repr, repr(parent.children()[0]))
def testChildren(self):
- #QObject.children()
+ # QObject.children()
parent = QObject()
children = [QObject(parent) for x in range(25)]
self.assertEqual(parent.children(), children)
def testFindChild(self):
- #QObject.findChild() with all QObject
+ # QObject.findChild() with all QObject
parent = QObject()
children = [QObject(parent) for i in range(20)]
@@ -123,7 +124,7 @@ class ParentCase(unittest.TestCase):
self.assertTrue(isinstance(child, QObject))
def testFindChildren(self):
- #QObject.findChildren() with all QObject
+ # QObject.findChildren() with all QObject
parent = QObject()
target_name = 'foo'
children = [QTimer(parent) for i in range(20)]
@@ -149,7 +150,7 @@ class ParentCase(unittest.TestCase):
self.assertEqual(res, test_children)
def testParentEquality(self):
- #QObject.parent() == parent
+ # QObject.parent() == parent
parent = QObject()
child = QObject(parent)
self.assertEqual(parent, child.parent())
@@ -170,7 +171,7 @@ class TestParentOwnership(unittest.TestCase):
self.assertEqual(getrefcount(child), 2)
# this will fail because parent deleted child cpp object
- self.assertRaises(RuntimeError, lambda :child.objectName())
+ self.assertRaises(RuntimeError, lambda: child.objectName())
# test parent with multiples children
def testMultipleChildren(self):
@@ -191,8 +192,8 @@ class TestParentOwnership(unittest.TestCase):
self.assertEqual(getrefcount(c2), 2)
# this will fail because parent deleted child cpp object
- self.assertRaises(RuntimeError, lambda :c.objectName())
- self.assertRaises(RuntimeError, lambda :c2.objectName())
+ self.assertRaises(RuntimeError, lambda: c.objectName())
+ self.assertRaises(RuntimeError, lambda: c2.objectName())
# test recursive parent
def testRecursiveParent(self):
@@ -213,8 +214,8 @@ class TestParentOwnership(unittest.TestCase):
self.assertEqual(getrefcount(c2), 2)
# this will fail because parent deleted child cpp object
- self.assertRaises(RuntimeError, lambda :c.objectName())
- self.assertRaises(RuntimeError, lambda :c2.objectName())
+ self.assertRaises(RuntimeError, lambda: c.objectName())
+ self.assertRaises(RuntimeError, lambda: c2.objectName())
# test parent transfer
def testParentTransfer(self):
@@ -238,6 +239,7 @@ class ExtQObject(QObject):
def __init__(self):
super().__init__()
+
class ReparentingTest(unittest.TestCase):
'''Test cases for reparenting'''
diff --git a/sources/pyside6/tests/QtCore/qobject_property_test.py b/sources/pyside6/tests/QtCore/qobject_property_test.py
index 7abe3ede0..d141a97df 100644
--- a/sources/pyside6/tests/QtCore/qobject_property_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_property_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Property, Signal
+
class MyObjectWithNotifyProperty(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -54,6 +55,7 @@ class MyObjectWithNotifyProperty(QObject):
notifyP = Signal()
myProperty = Property(int, readP, fset=writeP, notify=notifyP)
+
class PropertyWithNotify(unittest.TestCase):
def called(self):
self.called_ = True
diff --git a/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py b/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py
index baa62ac1e..e9f935482 100644
--- a/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py
@@ -41,19 +41,21 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QThread, SIGNAL
+
class Dummy(QObject):
'''Dummy class'''
pass
+
class QObjectReceivers(unittest.TestCase):
'''Test case for QObject.receivers()'''
def cb(self, *args):
- #Dummy callback
+ # Dummy callback
pass
def testQObjectReceiversExtern(self):
- #QObject.receivers() - Protected method external access
+ # QObject.receivers() - Protected method external access
obj = Dummy()
self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 0)
@@ -62,7 +64,7 @@ class QObjectReceivers(unittest.TestCase):
self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 1)
def testQThreadReceiversExtern(self):
- #QThread.receivers() - Inherited protected method
+ # QThread.receivers() - Inherited protected method
obj = QThread()
self.assertEqual(obj.receivers(SIGNAL('destroyed()')), 0)
diff --git a/sources/pyside6/tests/QtCore/qobject_test.py b/sources/pyside6/tests/QtCore/qobject_test.py
index d452e828e..3abbe1b44 100644
--- a/sources/pyside6/tests/QtCore/qobject_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_test.py
@@ -42,16 +42,19 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal, Qt
+
class Obj(QObject):
signal = Signal()
+
def empty(self):
pass
+
class ObjectNameCase(unittest.TestCase):
'''Tests related to QObject object name'''
def testSimple(self):
- #QObject.objectName(string)
+ # QObject.objectName(string)
name = 'object1'
obj = QObject()
obj.setObjectName(name)
@@ -59,7 +62,7 @@ class ObjectNameCase(unittest.TestCase):
self.assertEqual(name, obj.objectName())
def testEmpty(self):
- #QObject.objectName('')
+ # QObject.objectName('')
name = ''
obj = QObject()
obj.setObjectName(name)
@@ -67,13 +70,13 @@ class ObjectNameCase(unittest.TestCase):
self.assertEqual(name, obj.objectName())
def testDefault(self):
- #QObject.objectName() default
+ # QObject.objectName() default
obj = QObject()
self.assertEqual('', obj.objectName())
def testUnicode(self):
name = 'não'
- #FIXME Strange error on upstream when using equal(name, obj)
+ # FIXME Strange error on upstream when using equal(name, obj)
obj = QObject()
obj.setObjectName(name)
self.assertEqual(obj.objectName(), name)
@@ -85,5 +88,6 @@ class ObjectNameCase(unittest.TestCase):
self.assertTrue(obj.signal.connect(obj.empty, Qt.UniqueConnection))
self.assertFalse(obj.signal.connect(obj.empty, Qt.UniqueConnection))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py
index 0730dd1f0..8a7f4da7b 100644
--- a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py
@@ -43,6 +43,7 @@ from PySide6.QtCore import QObject, QCoreApplication
from helper.usesqcoreapplication import UsesQCoreApplication
+
class Dummy(QObject):
def __init__(self, app):
@@ -58,23 +59,25 @@ class Dummy(QObject):
if self.times_called == 5:
self.app.exit(0)
+
class QObjectTimerEvent(UsesQCoreApplication):
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(QObjectTimerEvent, self).setUp()
def tearDown(self):
- #Release resources
+ # Release resources
super(QObjectTimerEvent, self).tearDown()
def testTimerEvent(self):
- #QObject.timerEvent overloading
+ # QObject.timerEvent overloading
obj = Dummy(self.app)
timer_id = obj.startTimer(200)
self.app.exec_()
obj.killTimer(timer_id)
self.assertEqual(obj.times_called, 5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
index 4647a2c4b..796fc93a2 100644
--- a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
@@ -45,6 +45,7 @@ from PySide6.QtCore import QObject
#from helper.usesqcoreapplication import UsesQCoreApplication
+
class QObjectTrTest(unittest.TestCase):
'''Test case to check if QObject tr static methods could be treated as instance methods.'''
@@ -55,7 +56,7 @@ class QObjectTrTest(unittest.TestCase):
del self.obj
def testTrCommonCase(self):
- #Test common case for QObject.tr
+ # Test common case for QObject.tr
invar1 = 'test1'
outvar1 = self.obj.tr(invar1)
invar2 = 'test2'
@@ -63,13 +64,14 @@ class QObjectTrTest(unittest.TestCase):
self.assertEqual((invar1, invar2), (outvar1, outvar2))
def testTrAsInstanceMethod(self):
- #Test QObject.tr as instance
+ # Test QObject.tr as instance
invar1 = 'test1'
outvar1 = QObject.tr(self.obj, invar1)
invar2 = 'test2'
outvar2 = QObject.tr(self.obj, invar2, 'test comment')
self.assertEqual((invar1, invar2), (outvar1, outvar2))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py b/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py
index 0b336ca01..e7c784300 100644
--- a/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py
+++ b/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QOperatingSystemVersion
+
class TestQOperatingSystemVersion(unittest.TestCase):
def test(self):
ov = QOperatingSystemVersion.current()
name = f"{ov.name()} v{ov.majorVersion()}.{ov.minorVersion()}.{ov.microVersion()}"
print(name)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qpoint_test.py b/sources/pyside6/tests/QtCore/qpoint_test.py
index 49a4d8c25..a2a92d3ef 100644
--- a/sources/pyside6/tests/QtCore/qpoint_test.py
+++ b/sources/pyside6/tests/QtCore/qpoint_test.py
@@ -43,12 +43,14 @@ from PySide6.QtCore import QPoint, QPointF
class QPointTest(unittest.TestCase):
def testQPointCtor(self):
- point = QPoint(QPoint(10,20))
+ point = QPoint(QPoint(10, 20))
+
class QPointFTest(unittest.TestCase):
def testQPointFCtor(self):
- pointf = QPointF(QPoint(10,20))
+ pointf = QPointF(QPoint(10, 20))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qprocess_test.py b/sources/pyside6/tests/QtCore/qprocess_test.py
index 9e9ca348f..9634f26d3 100644
--- a/sources/pyside6/tests/QtCore/qprocess_test.py
+++ b/sources/pyside6/tests/QtCore/qprocess_test.py
@@ -61,5 +61,6 @@ class TestQProcess (unittest.TestCase):
else:
print("PROCESS ALREADY DEAD :-/")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qproperty_decorator.py b/sources/pyside6/tests/QtCore/qproperty_decorator.py
index 3d9503272..424b9dc9a 100644
--- a/sources/pyside6/tests/QtCore/qproperty_decorator.py
+++ b/sources/pyside6/tests/QtCore/qproperty_decorator.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Property
+
class MyObject(QObject):
def __init__(self):
super().__init__()
@@ -68,5 +69,6 @@ class PropertyTest(unittest.TestCase):
del o
self.assertTrue(self._obDestroyed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qrandomgenerator_test.py b/sources/pyside6/tests/QtCore/qrandomgenerator_test.py
index fc1c7b872..36d2a0e03 100644
--- a/sources/pyside6/tests/QtCore/qrandomgenerator_test.py
+++ b/sources/pyside6/tests/QtCore/qrandomgenerator_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QRandomGenerator, QRandomGenerator64
+
class QRandomGeneratorTest(unittest.TestCase):
'''Test case for QRandomGenerator'''
@@ -52,5 +53,6 @@ class QRandomGeneratorTest(unittest.TestCase):
generator = QRandomGenerator64()
r = generator.generate()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qrect_test.py b/sources/pyside6/tests/QtCore/qrect_test.py
index 8420f0246..83c3618d5 100644
--- a/sources/pyside6/tests/QtCore/qrect_test.py
+++ b/sources/pyside6/tests/QtCore/qrect_test.py
@@ -41,10 +41,11 @@ init_test_paths(False)
from PySide6.QtCore import QPoint, QRect, QRectF
+
class RectConstructor(unittest.TestCase):
def testDefault(self):
- #QRect()
+ # QRect()
obj = QRect()
self.assertTrue(obj.isNull())
@@ -58,6 +59,7 @@ class RectConstructor(unittest.TestCase):
self.assertEqual(rect1, rect2)
+
class RectOperator(unittest.TestCase):
'''Test case for QRect operators'''
@@ -74,7 +76,7 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect1, rect2)
def testNullRectIntersection(self):
- #QRect & QRect for null rects
+ # QRect & QRect for null rects
rect1 = QRect()
rect2 = QRect()
rect3 = rect1 & rect2
@@ -90,21 +92,21 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect3, QRect())
def testIntersectPartial(self):
- #QRect & QRect for partial intersections
+ # QRect & QRect for partial intersections
rect1 = QRect(10, 10, 10, 10)
rect2 = QRect(15, 15, 10, 10)
rect3 = rect1 & rect2
self.assertEqual(rect3, QRect(15, 15, 5, 5))
def testIntersetEnclosed(self):
- #QRect & QRect for a qrect inside another
+ # QRect & QRect for a qrect inside another
rect1 = QRect(10, 10, 20, 20)
rect2 = QRect(15, 15, 5, 5)
rect3 = rect1 & rect2
self.assertEqual(rect3, rect2)
def testNullRectIntersectBounding(self):
- #QRect | QRect for null rects
+ # QRect | QRect for null rects
rect1 = QRect()
rect2 = QRect()
rect3 = rect1 & rect2
@@ -120,14 +122,14 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect3, QRect(10, 10, 15, 15))
def testBoundingPartialIntersection(self):
- #QRect | QRect for partial intersections
+ # QRect | QRect for partial intersections
rect1 = QRect(10, 10, 10, 10)
rect2 = QRect(15, 15, 10, 10)
rect3 = rect1 | rect2
self.assertEqual(rect3, QRect(10, 10, 15, 15))
def testBoundingEnclosed(self):
- #QRect | QRect for a qrect inside another
+ # QRect | QRect for a qrect inside another
rect1 = QRect(10, 10, 20, 20)
rect2 = QRect(15, 15, 5, 5)
rect3 = rect1 | rect2
@@ -143,6 +145,5 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect1.getCoords(), (1, 2, 4, 6))
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qregularexpression_test.py b/sources/pyside6/tests/QtCore/qregularexpression_test.py
index 457ff7460..20b582259 100644
--- a/sources/pyside6/tests/QtCore/qregularexpression_test.py
+++ b/sources/pyside6/tests/QtCore/qregularexpression_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QRegularExpression, QRegularExpressionMatch, QRegularExpressionMatchIterator
+
class QRegularExpressionTest(unittest.TestCase):
def testMatch(self):
@@ -55,11 +56,12 @@ class QRegularExpressionTest(unittest.TestCase):
re = QRegularExpression('(\w+)')
self.assertTrue(re.isValid())
count = 0
- it = re.globalMatch('word1 word2 word3');
+ it = re.globalMatch('word1 word2 word3')
while it.hasNext():
it.next()
- count = count + 1
+ count = count + 1
self.assertEqual(count, 3)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qresource_test.py b/sources/pyside6/tests/QtCore/qresource_test.py
index bc6fa0aa1..a9bdbfe51 100644
--- a/sources/pyside6/tests/QtCore/qresource_test.py
+++ b/sources/pyside6/tests/QtCore/qresource_test.py
@@ -42,11 +42,12 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray, QFile, QIODevice
import resources_mc
+
class ResourcesUsage(unittest.TestCase):
'''Test case for resources usage'''
def testPhrase(self):
- #Test loading of quote.txt resource
+ # Test loading of quote.txt resource
file = Path(__file__).resolve().parent / 'quoteEnUS.txt'
self.assertTrue(file.is_file())
orig = QByteArray(file.read_bytes())
@@ -64,7 +65,7 @@ class ResourcesUsage(unittest.TestCase):
self.assertEqual(orig, copy)
def testImage(self):
- #Test loading of sample.png resource
+ # Test loading of sample.png resource
file = Path(__file__).resolve().parent / 'sample.png'
self.assertTrue(file.is_file())
orig = file.read_bytes()
diff --git a/sources/pyside6/tests/QtCore/qsettings_test.py b/sources/pyside6/tests/QtCore/qsettings_test.py
index d46242220..bbb82dc97 100644
--- a/sources/pyside6/tests/QtCore/qsettings_test.py
+++ b/sources/pyside6/tests/QtCore/qsettings_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QDir, QSettings, QTemporaryDir
+
class TestQSettings(unittest.TestCase):
def testConversions(self):
file = Path(__file__).resolve().parent / 'qsettings_test.ini'
@@ -55,7 +56,6 @@ class TestQSettings(unittest.TestCase):
r = settings.value('var2', type=list)
self.assertEqual(type(r), list)
-
def testDefaultValueConversion(self):
temp_dir = QDir.tempPath()
dir = QTemporaryDir(f'{temp_dir}/qsettings_XXXXXX')
@@ -117,5 +117,6 @@ class TestQSettings(unittest.TestCase):
r = settings.value('lala', 22, type=float)
self.assertEqual(type(r), float)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qsize_test.py b/sources/pyside6/tests/QtCore/qsize_test.py
index 2429352c9..95705f51c 100644
--- a/sources/pyside6/tests/QtCore/qsize_test.py
+++ b/sources/pyside6/tests/QtCore/qsize_test.py
@@ -41,16 +41,17 @@ init_test_paths(False)
from PySide6.QtCore import QSize
+
class QSizeOperator(unittest.TestCase):
def testOperatorMultiply(self):
- #QSize operator * float
+ # QSize operator * float
# bug 131
a = QSize(1, 1)
x = a * 3.4
self.assertEqual(QSize(3, 3), x)
def testOperatorRevertedMultiply(self):
- #QSize operator * float, reverted
+ # QSize operator * float, reverted
# bug 132
a = QSize(1, 1)
x = 3.4 * a
diff --git a/sources/pyside6/tests/QtCore/qslot_object_test.py b/sources/pyside6/tests/QtCore/qslot_object_test.py
index ebde10387..f08791be2 100644
--- a/sources/pyside6/tests/QtCore/qslot_object_test.py
+++ b/sources/pyside6/tests/QtCore/qslot_object_test.py
@@ -44,6 +44,7 @@ This is a simple slot test that was updated to use the qApp "macro".
It is implicitly in builtins and does not need an import.
"""
+
class objTest(QObject):
def __init__(self, parent=None):
diff --git a/sources/pyside6/tests/QtCore/qsrand_test.py b/sources/pyside6/tests/QtCore/qsrand_test.py
index 4db29e24f..4208ab951 100644
--- a/sources/pyside6/tests/QtCore/qsrand_test.py
+++ b/sources/pyside6/tests/QtCore/qsrand_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QRandomGenerator
+
class OverflowExceptionCollect(unittest.TestCase):
'''Test case for OverflowError exception during garbage collection. See bug #147'''
@@ -47,5 +48,6 @@ class OverflowExceptionCollect(unittest.TestCase):
# should not abort if bug #147 is fixed
gc.collect()
+
if __name__ == '__main__':
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qstandardpaths_test.py b/sources/pyside6/tests/QtCore/qstandardpaths_test.py
index 0e5e7358d..070942474 100644
--- a/sources/pyside6/tests/QtCore/qstandardpaths_test.py
+++ b/sources/pyside6/tests/QtCore/qstandardpaths_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QStandardPaths
+
class QStandardPathsTest(unittest.TestCase):
def testTestModeEnabled(self):
print("QStandardPaths.isTestModeEnabled:", QStandardPaths.isTestModeEnabled())
@@ -52,5 +53,6 @@ class QStandardPathsTest(unittest.TestCase):
QStandardPaths.setTestModeEnabled(sp)
self.assertEqual(QStandardPaths.isTestModeEnabled(), sp)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qstorageinfo_test.py b/sources/pyside6/tests/QtCore/qstorageinfo_test.py
index b86b85c1c..35413f081 100644
--- a/sources/pyside6/tests/QtCore/qstorageinfo_test.py
+++ b/sources/pyside6/tests/QtCore/qstorageinfo_test.py
@@ -41,10 +41,12 @@ init_test_paths(False)
from PySide6.QtCore import QStorageInfo
+
class QandardPathsTest(unittest.TestCase):
def testQStorageInfo(self):
for v in QStorageInfo.mountedVolumes():
print(v.name(), v.rootPath(), v.device())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qstring_test.py b/sources/pyside6/tests/QtCore/qstring_test.py
index a07a559a3..a43b2b94a 100644
--- a/sources/pyside6/tests/QtCore/qstring_test.py
+++ b/sources/pyside6/tests/QtCore/qstring_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class QStringConstructor(unittest.TestCase):
'''Test case for QString constructors'''
@@ -54,5 +55,6 @@ class QStringConstructor(unittest.TestCase):
obj.setObjectName(None)
self.assertEqual(obj.objectName(), '')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qsysinfo_test.py b/sources/pyside6/tests/QtCore/qsysinfo_test.py
index 90e241775..ebd0f82ee 100644
--- a/sources/pyside6/tests/QtCore/qsysinfo_test.py
+++ b/sources/pyside6/tests/QtCore/qsysinfo_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QSysInfo
+
class TestQSysInfo(unittest.TestCase):
def testEnumEndian(self):
self.assertEqual(QSysInfo.BigEndian, 0)
@@ -46,5 +47,6 @@ class TestQSysInfo(unittest.TestCase):
def testEnumSizes(self):
self.assertTrue(QSysInfo.WordSize > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtextstream_test.py b/sources/pyside6/tests/QtCore/qtextstream_test.py
index b48f716bc..64be2b9a3 100644
--- a/sources/pyside6/tests/QtCore/qtextstream_test.py
+++ b/sources/pyside6/tests/QtCore/qtextstream_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray, QTextStream, QIODevice, QFile
+
class QTextStreamShiftTest(unittest.TestCase):
def setUp(self):
@@ -55,6 +56,7 @@ class QTextStreamShiftTest(unittest.TestCase):
self.assertTrue(isinstance(res, str))
self.assertEqual(res, '4')
+
class QTextStreamGetSet(unittest.TestCase):
def setUp(self):
@@ -68,6 +70,7 @@ class QTextStreamGetSet(unittest.TestCase):
self.obj.setDevice(None)
self.assertEqual(None, self.obj.device())
+
class QTextStreamInitialization(unittest.TestCase):
def testConstruction(self):
@@ -80,6 +83,7 @@ class QTextStreamInitialization(unittest.TestCase):
self.assertTrue(obj.atEnd())
self.assertEqual(obj.readAll(), '')
+
class QTextStreamReadLinesFromDevice(unittest.TestCase):
def _check_data(self, data_set):
@@ -108,5 +112,6 @@ class QTextStreamReadLinesFromDevice(unittest.TestCase):
self._check_data(data)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
index 339c0a7d6..4b36b7063 100644
--- a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
+++ b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
@@ -45,36 +45,38 @@ logging.basicConfig(level=logging.WARNING)
from PySide6.QtCore import QThread, QCoreApplication, QObject, SIGNAL
+
class Bucket(QObject):
'''Dummy class to hold the produced values'''
def __init__(self, max_size=10, *args):
- #Constructor which receives the max number of produced items
+ # Constructor which receives the max number of produced items
super().__init__(*args)
self.data = []
self.max_size = 10
def pop(self):
- #Retrieves an item
+ # Retrieves an item
return self.data.pop(0)
def push(self, data):
- #Pushes an item
+ # Pushes an item
self.data.append(data)
+
class Producer(QThread):
'''Producer thread'''
def __init__(self, bucket, *args):
- #Constructor. Receives the bucket
+ # Constructor. Receives the bucket
super().__init__(*args)
self.runs = 0
self.bucket = bucket
self.production_list = []
def run(self):
- #Produces at most bucket.max_size items
+ # Produces at most bucket.max_size items
while self.runs < self.bucket.max_size:
- value = int(random()*10) % 10
+ value = int(random() * 10) % 10
self.bucket.push(value)
self.production_list.append(value)
logging.debug(f'PRODUCER - pushed {value}')
@@ -82,18 +84,17 @@ class Producer(QThread):
self.msleep(5)
-
class Consumer(QThread):
'''Consumer thread'''
def __init__(self, bucket, *args):
- #Constructor. Receives the bucket
+ # Constructor. Receives the bucket
super().__init__(*args)
self.runs = 0
self.bucket = bucket
self.consumption_list = []
def run(self):
- #Consumes at most bucket.max_size items
+ # Consumes at most bucket.max_size items
while self.runs < self.bucket.max_size:
try:
value = self.bucket.pop()
@@ -104,23 +105,24 @@ class Consumer(QThread):
logging.debug('CONSUMER - empty bucket')
self.msleep(5)
+
class ProducerConsumer(unittest.TestCase):
'''Basic test case for producer-consumer QThread'''
def setUp(self):
- #Create fixtures
+ # Create fixtures
self.app = QCoreApplication([])
def tearDown(self):
- #Destroy fixtures
+ # Destroy fixtures
del self.app
def finishCb(self):
- #Quits the application
+ # Quits the application
self.app.exit(0)
def testProdCon(self):
- #QThread producer-consumer example
+ # QThread producer-consumer example
bucket = Bucket()
prod = Producer(bucket)
cons = Consumer(bucket)
diff --git a/sources/pyside6/tests/QtCore/qthread_signal_test.py b/sources/pyside6/tests/QtCore/qthread_signal_test.py
index c50ec0101..d105e93f3 100644
--- a/sources/pyside6/tests/QtCore/qthread_signal_test.py
+++ b/sources/pyside6/tests/QtCore/qthread_signal_test.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import QThread, QObject, SIGNAL, QCoreApplication
thread_run = False
+
class Source(QObject):
def __init__(self, *args):
QObject.__init__(self, *args)
@@ -48,6 +49,7 @@ class Source(QObject):
def emit_sig(self):
self.emit(SIGNAL('source()'))
+
class Target(QObject):
def __init__(self, *args):
QObject.__init__(self, *args)
@@ -56,6 +58,7 @@ class Target(QObject):
def myslot(self):
self.called = True
+
class ThreadJustConnects(QThread):
def __init__(self, source, *args):
QThread.__init__(self, *args)
@@ -71,7 +74,6 @@ class ThreadJustConnects(QThread):
pass
-
class BasicConnection(unittest.TestCase):
def testEmitOutsideThread(self):
@@ -94,5 +96,6 @@ class BasicConnection(unittest.TestCase):
self.assertTrue(thread.target.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qthread_test.py b/sources/pyside6/tests/QtCore/qthread_test.py
index 666d55b7e..25ef5d665 100644
--- a/sources/pyside6/tests/QtCore/qthread_test.py
+++ b/sources/pyside6/tests/QtCore/qthread_test.py
@@ -46,6 +46,7 @@ from helper.usesqcoreapplication import UsesQCoreApplication
mutex = QMutex()
+
class Dummy(QThread):
'''Dummy thread'''
def __init__(self, *args):
@@ -53,12 +54,13 @@ class Dummy(QThread):
self.called = False
def run(self):
- #Start-quit sequence
+ # Start-quit sequence
self.qobj = QObject()
mutex.lock()
self.called = True
mutex.unlock()
+
class QThreadSimpleCase(UsesQCoreApplication):
def setUp(self):
@@ -69,7 +71,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
UsesQCoreApplication.tearDown(self)
def testThread(self):
- #Basic QThread test
+ # Basic QThread test
obj = Dummy()
obj.start()
self.assertTrue(obj.wait(100))
@@ -78,7 +80,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
def cb(self, *args):
self.called = True
- #self.exit_app_cb()
+ # self.exit_app_cb()
def abort_application(self):
if self._thread.isRunning():
@@ -86,7 +88,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
self.app.quit()
def testSignalFinished(self):
- #QThread.finished() (signal)
+ # QThread.finished() (signal)
obj = Dummy()
QObject.connect(obj, SIGNAL('finished()'), self.cb)
mutex.lock()
@@ -100,7 +102,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
self.assertTrue(self.called)
def testSignalStarted(self):
- #QThread.started() (signal)
+ # QThread.started() (signal)
obj = Dummy()
QObject.connect(obj, SIGNAL('started()'), self.cb)
obj.start()
@@ -109,8 +111,9 @@ class QThreadSimpleCase(UsesQCoreApplication):
QTimer.singleShot(1000, self.abort_application)
self.app.exec_()
- self.assertEqual(obj.qobj.thread(), obj) # test QObject.thread() method
+ self.assertEqual(obj.qobj.thread(), obj) # test QObject.thread() method
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
index 71f497e54..56d02014b 100644
--- a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
+++ b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QTimer, QCoreApplication, Signal
from helper.usesqcoreapplication import UsesQCoreApplication
+
class WatchDog(QObject):
'''Exits the QCoreApplication main loop after sometime.'''
@@ -55,17 +56,18 @@ class WatchDog(QObject):
if self.times_called == 20:
self.watched.exit_app_cb()
+
class TestSingleShot(UsesQCoreApplication):
'''Test case for QTimer.singleShot'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
UsesQCoreApplication.setUp(self)
self.watchdog = WatchDog(self)
self.called = False
def tearDown(self):
- #Release resources
+ # Release resources
del self.watchdog
del self.called
UsesQCoreApplication.tearDown(self)
@@ -79,6 +81,7 @@ class TestSingleShot(UsesQCoreApplication):
self.app.exec_()
self.assertTrue(self.called)
+
class SigEmitter(QObject):
sig1 = Signal()
@@ -108,6 +111,7 @@ class TestSingleShotSignal(UsesQCoreApplication):
self.app.exec_()
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
index 6f6ff5297..a183d8dd1 100644
--- a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
+++ b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
@@ -59,25 +59,25 @@ class TestTimeoutSignal(UsesQCoreApplication):
'''Test case to check if the signals are really being caught'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
UsesQCoreApplication.setUp(self)
self.watchdog = WatchDog(self)
self.timer = QTimer()
self.called = False
def tearDown(self):
- #Release resources
+ # Release resources
del self.watchdog
del self.timer
del self.called
UsesQCoreApplication.tearDown(self)
def callback(self, *args):
- #Default callback
+ # Default callback
self.called = True
def testTimeoutSignal(self):
- #Test the QTimer timeout() signal
+ # Test the QTimer timeout() signal
refCount = sys.getrefcount(self.timer)
QObject.connect(self.timer, SIGNAL('timeout()'), self.callback)
self.timer.start(4)
@@ -88,6 +88,7 @@ class TestTimeoutSignal(UsesQCoreApplication):
self.assertTrue(self.called)
self.assertEqual(sys.getrefcount(self.timer), refCount)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtimezone_test.py b/sources/pyside6/tests/QtCore/qtimezone_test.py
index d143d0c94..da96f90e7 100644
--- a/sources/pyside6/tests/QtCore/qtimezone_test.py
+++ b/sources/pyside6/tests/QtCore/qtimezone_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QTimeZone
+
class TestQTimeZone (unittest.TestCase):
def testTimeZone(self):
id = bytes('Europe/Berlin', "UTF-8")
@@ -46,5 +47,6 @@ class TestQTimeZone (unittest.TestCase):
name = timeZone.displayName(QTimeZone.GenericTime, QTimeZone.DefaultName)
self.assertTrue(name)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtnamespace_test.py b/sources/pyside6/tests/QtCore/qtnamespace_test.py
index 7244fd89e..2f76ffcad 100644
--- a/sources/pyside6/tests/QtCore/qtnamespace_test.py
+++ b/sources/pyside6/tests/QtCore/qtnamespace_test.py
@@ -41,11 +41,12 @@ init_test_paths(False)
from PySide6.QtCore import Qt
+
class QtNamespace(unittest.TestCase):
'''Test case for accessing attributes from Qt namespace'''
def testBasic(self):
- #Access to Qt namespace
+ # Access to Qt namespace
getattr(Qt, 'Horizontal')
getattr(Qt, 'WindowMaximizeButtonHint')
self.assertTrue(True)
diff --git a/sources/pyside6/tests/QtCore/qurl_test.py b/sources/pyside6/tests/QtCore/qurl_test.py
index 75f74fbbc..8e5d5caea 100644
--- a/sources/pyside6/tests/QtCore/qurl_test.py
+++ b/sources/pyside6/tests/QtCore/qurl_test.py
@@ -42,16 +42,17 @@ init_test_paths(False)
from PySide6.QtCore import QUrl
from PySide6.QtCore import QUrlQuery
+
class QUrlBasicConstructor(unittest.TestCase):
'''Tests the basic constructors'''
def testBasic(self):
- #Default constructor for QUrl
+ # Default constructor for QUrl
url = QUrl()
self.assertEqual(url.toString(), "")
def testSetAttributes(self):
- #Construct QUrl by set* methods
+ # Construct QUrl by set* methods
url = QUrl()
url.setScheme('ftp')
@@ -75,6 +76,7 @@ class QUrlBasicConstructor(unittest.TestCase):
self.assertEqual(url.toString(),
'ftp://john:abc123@www.google.com:8080/mail/view')
+
class QueryItemsTest(unittest.TestCase):
'''Test query item management'''
@@ -116,13 +118,15 @@ class QueryItemsTest(unittest.TestCase):
for i, data in enumerate(valid_data):
url.addQueryItem(key, data)
self.assertEqual(url.allQueryItemValues(key),
- list(valid_data[:i+1]))
+ list(valid_data[:i + 1]))
def testPath(self):
url = QUrl("http://qt-project.org/images/ban/pgs_front.jpg")
self.assertEqual(url.path(), "/images/ban/pgs_front.jpg")
# PYSIDE-345: No bindings for QUrlQuery
+
+
class QueryItemsTest(unittest.TestCase):
'''Test query item management'''
@@ -164,7 +168,8 @@ class QueryItemsTest(unittest.TestCase):
for i, data in enumerate(valid_data):
url.addQueryItem(key, data)
self.assertEqual(url.allQueryItemValues(key),
- list(valid_data[:i+1]))
+ list(valid_data[:i + 1]))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qurlquery_test.py b/sources/pyside6/tests/QtCore/qurlquery_test.py
index 4e2a8fc14..224f253ff 100644
--- a/sources/pyside6/tests/QtCore/qurlquery_test.py
+++ b/sources/pyside6/tests/QtCore/qurlquery_test.py
@@ -42,22 +42,24 @@ init_test_paths(False)
from PySide6.QtCore import QUrlQuery
+
class QUrlQueryTest(unittest.TestCase):
def testConstructing(self):
empty = QUrlQuery()
self.assertTrue(empty.isEmpty())
- empty.clear();
+ empty.clear()
self.assertTrue(empty.isEmpty())
def testAddRemove(self):
query = QUrlQuery()
- query.addQueryItem("a", "b");
+ query.addQueryItem("a", "b")
self.assertTrue(not query.isEmpty())
self.assertTrue(query.hasQueryItem("a"))
self.assertEqual(query.queryItemValue("a"), "b")
self.assertEqual(query.allQueryItemValues("a"), ["b"])
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/quuid_test.py b/sources/pyside6/tests/QtCore/quuid_test.py
index 215ab68e8..1729eb146 100644
--- a/sources/pyside6/tests/QtCore/quuid_test.py
+++ b/sources/pyside6/tests/QtCore/quuid_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QUuid
+
class QUuidTest(unittest.TestCase):
def testFromString(self):
uuidString = '{fc69b59e-cc34-4436-a43c-ee95d128b8c5}'
@@ -49,5 +50,6 @@ class QUuidTest(unittest.TestCase):
self.assertTrue(not uuid.isNull())
self.assertEqual(uuid.toString(), uuidString)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qversionnumber_test.py b/sources/pyside6/tests/QtCore/qversionnumber_test.py
index d08a64d25..eb02573a3 100644
--- a/sources/pyside6/tests/QtCore/qversionnumber_test.py
+++ b/sources/pyside6/tests/QtCore/qversionnumber_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QVersionNumber
+
class QVersionNumberTest(unittest.TestCase):
def testFromString(self):
versionString = '5.9.2'
@@ -51,5 +52,6 @@ class QVersionNumberTest(unittest.TestCase):
self.assertEqual(version.microVersion(), 2)
self.assertEqual(version.toString(), versionString)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/repr_test.py b/sources/pyside6/tests/QtCore/repr_test.py
index 72a5e3a9a..8fdb65ef8 100644
--- a/sources/pyside6/tests/QtCore/repr_test.py
+++ b/sources/pyside6/tests/QtCore/repr_test.py
@@ -44,12 +44,14 @@ try:
except ImportError:
HAVE_Q = False
+
class ReprCopyHelper:
def testCopy(self):
copy = eval(self.original.__repr__())
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class QByteArrayReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QByteArray(bytes('the quick brown fox jumps over the lazy dog', "UTF-8"))
@@ -79,34 +81,42 @@ class QSizeFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QSizeF(42.7, 190.2)
+
class QRectReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QRect(100, 200, 300, 400)
+
class QRectFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QRectF(100.33, 200.254, 300.321, 400.123)
+
class QLineReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLine(1, 2, 3, 4)
+
class QLineFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLineF(1.1, 2.2, 3.3, 4.4)
+
class QPointReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPoint(1, 2)
+
class QPointFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPointF(1.1, 2.2)
+
class QUuiCopy(ReprCopyHelper, unittest.TestCase):
@unittest.skipUnless(HAVE_Q, "QUuid is currently not supported on this platform.")
def setUp(self):
self.original = QUuid("67C8770B-44F1-410A-AB9A-F9B5446F13EE")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/resources_mc.py b/sources/pyside6/tests/QtCore/resources_mc.py
index 0de0a8774..acbc561bb 100644
--- a/sources/pyside6/tests/QtCore/resources_mc.py
+++ b/sources/pyside6/tests/QtCore/resources_mc.py
@@ -3562,10 +3562,13 @@ qt_resource_struct = b"""\
\x00\x00\x00\x18\x00\x00\x00\x00\x00\x01\x00\x00\x00\x39\
"""
+
def qInitResources():
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
+
def qCleanupResources():
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
+
qInitResources()
diff --git a/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py b/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py
index a5cded3ac..0cd56ac93 100644
--- a/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py
+++ b/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py
@@ -42,8 +42,9 @@ from PySide6.QtCore import QTimer
class SetPropOnCtorTest(unittest.TestCase):
def testIt(self):
- timer = QTimer(interval = 42)
- self.assertEqual(timer.interval(), 42);
+ timer = QTimer(interval=42)
+ self.assertEqual(timer.interval(), 42)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
index 9c871dab1..6bfcddec0 100644
--- a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
+++ b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
@@ -58,6 +58,7 @@ Test the snake_case and true_property feature.
This works now, including class properties.
"""
+
class Window(QWidget):
def __init__(self):
super().__init__()
diff --git a/sources/pyside6/tests/QtCore/staticMetaObject_test.py b/sources/pyside6/tests/QtCore/staticMetaObject_test.py
index 29ab9a358..77dbcd9fb 100644
--- a/sources/pyside6/tests/QtCore/staticMetaObject_test.py
+++ b/sources/pyside6/tests/QtCore/staticMetaObject_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Slot, QMetaObject
+
class MyObject(QObject):
@Slot(int, str)
def slot1(self, a, b):
pass
+
class testAttribute(unittest.TestCase):
def testBug896(self):
mo = MyObject.staticMetaObject
@@ -54,5 +56,6 @@ class testAttribute(unittest.TestCase):
self.assertEqual(mo.indexOfSignal('destroyed(void)'), -1)
self.assertTrue(mo.indexOfSignal('destroyed()') > -1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/static_method_test.py b/sources/pyside6/tests/QtCore/static_method_test.py
index c395f3770..5119f42a9 100644
--- a/sources/pyside6/tests/QtCore/static_method_test.py
+++ b/sources/pyside6/tests/QtCore/static_method_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QFile
+
class StaticNonStaticMethodsTest(unittest.TestCase):
'''Test cases for overloads involving static and non-static versions of a method.'''
diff --git a/sources/pyside6/tests/QtCore/thread_signals_test.py b/sources/pyside6/tests/QtCore/thread_signals_test.py
index 21e4d7043..0aaa251bb 100644
--- a/sources/pyside6/tests/QtCore/thread_signals_test.py
+++ b/sources/pyside6/tests/QtCore/thread_signals_test.py
@@ -40,14 +40,17 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, QFile, QThread, QTimer, Qt
from helper.usesqcoreapplication import UsesQCoreApplication
+
class MyThread(QThread):
def run(self):
- self.emit(SIGNAL("test(const QString&)"), "INdT - PySide");
+ self.emit(SIGNAL("test(const QString&)"), "INdT - PySide")
+
class TestThreadSignal(UsesQCoreApplication):
__called__ = True
+
def _callback(self, msg):
self.assertEqual(msg, "INdT - PySide")
self.__called__ = True
@@ -55,12 +58,13 @@ class TestThreadSignal(UsesQCoreApplication):
def testThread(self):
t = MyThread()
- QObject.connect(t, SIGNAL("test(const QString&)"), self._callback);
+ QObject.connect(t, SIGNAL("test(const QString&)"), self._callback)
t.start()
self.app.exec_()
t.wait()
- self.assertTrue(self.__called__);
+ self.assertTrue(self.__called__)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/tr_noop_test.py b/sources/pyside6/tests/QtCore/tr_noop_test.py
index 5743c94a3..b2139e754 100644
--- a/sources/pyside6/tests/QtCore/tr_noop_test.py
+++ b/sources/pyside6/tests/QtCore/tr_noop_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QT_TR_NOOP, QT_TR_NOOP_UTF8
from PySide6.QtCore import QT_TRANSLATE_NOOP, QT_TRANSLATE_NOOP3, QT_TRANSLATE_NOOP_UTF8
+
class QtTrNoopTest(unittest.TestCase):
def setUp(self):
diff --git a/sources/pyside6/tests/QtCore/translation_test.py b/sources/pyside6/tests/QtCore/translation_test.py
index 28e618534..fbce644e0 100644
--- a/sources/pyside6/tests/QtCore/translation_test.py
+++ b/sources/pyside6/tests/QtCore/translation_test.py
@@ -44,6 +44,7 @@ from PySide6.QtCore import QObject, QTranslator, QCoreApplication
from helper.usesqcoreapplication import UsesQCoreApplication
+
class TranslationTest(UsesQCoreApplication):
'''Test case for Qt translation facilities.'''
@@ -52,7 +53,7 @@ class TranslationTest(UsesQCoreApplication):
self.trdir = os.path.join(os.path.dirname(__file__), 'translations')
def testLatin(self):
- #Set string value to Latin
+ # Set string value to Latin
translator = QTranslator()
translator.load(os.path.join(self.trdir, 'trans_latin.qm'))
self.app.installTranslator(translator)
@@ -62,7 +63,7 @@ class TranslationTest(UsesQCoreApplication):
self.assertEqual(obj.objectName(), 'Orbis, te saluto!')
def testRussian(self):
- #Set string value to Russian
+ # Set string value to Russian
translator = QTranslator()
translator.load(os.path.join(self.trdir, 'trans_russian.qm'))
self.app.installTranslator(translator)
@@ -86,6 +87,7 @@ class TranslationTest(UsesQCoreApplication):
self.assertTrue(isinstance(obj, str))
self.assertEqual(obj, value)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/unaryoperator_test.py b/sources/pyside6/tests/QtCore/unaryoperator_test.py
index fada917ee..614c92ee5 100644
--- a/sources/pyside6/tests/QtCore/unaryoperator_test.py
+++ b/sources/pyside6/tests/QtCore/unaryoperator_test.py
@@ -41,17 +41,18 @@ init_test_paths(False)
from PySide6.QtCore import QPoint
+
class NegUnaryOperatorTest(unittest.TestCase):
'''Tests the presence of unary operator __neg__ on the QPoint class'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.x, self.y = 10, 20
self.neg_x, self.neg_y = -self.x, -self.y
self.qpoint = QPoint(self.x, self.y)
def tearDown(self):
- #Release resources
+ # Release resources
del self.qpoint
del self.x
del self.y
@@ -59,7 +60,7 @@ class NegUnaryOperatorTest(unittest.TestCase):
del self.neg_y
def testNegUnaryOperator(self):
- #Test __neg__ unary operator on QPoint class
+ # Test __neg__ unary operator on QPoint class
__neg__method_exists = True
try:
neg_qpoint = -self.qpoint
@@ -69,6 +70,7 @@ class NegUnaryOperatorTest(unittest.TestCase):
self.assertTrue(__neg__method_exists)
self.assertEqual(self.qpoint, -neg_qpoint)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/unicode_test.py b/sources/pyside6/tests/QtCore/unicode_test.py
index 1d3a729fa..18910be29 100644
--- a/sources/pyside6/tests/QtCore/unicode_test.py
+++ b/sources/pyside6/tests/QtCore/unicode_test.py
@@ -43,6 +43,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
from PySide6.QtCore import QByteArray
+
class UnicodeConversion(unittest.TestCase):
'''Test case for QString to/from Python Unicode conversion'''
@@ -53,17 +54,18 @@ class UnicodeConversion(unittest.TestCase):
pass
def testSetRegularStringRetrieveUnicode(self):
- #Set regular Python string retrieve unicode
+ # Set regular Python string retrieve unicode
obj = QObject()
obj.setObjectName('test')
self.assertEqual(obj.objectName(), 'test')
def testSetUnicodeRetrieveUnicode(self):
- #Set Python unicode string and retrieve unicode
+ # Set Python unicode string and retrieve unicode
obj = QObject()
obj.setObjectName('ümlaut')
self.assertEqual(obj.objectName(), 'ümlaut')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/versioninfo_test.py b/sources/pyside6/tests/QtCore/versioninfo_test.py
index 9a31dfc00..85d774dde 100644
--- a/sources/pyside6/tests/QtCore/versioninfo_test.py
+++ b/sources/pyside6/tests/QtCore/versioninfo_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
import PySide6
+
class TestVersionInfo(unittest.TestCase):
def testIt(self):