aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtWidgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 11:18:49 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 15:56:58 +0200
commit6d2af409eedee377b3c2ba0cd8156b9409fabd9d (patch)
tree660f8fd87f77c1030cf97cc65345b9a941a321e4 /sources/pyside6/tests/QtWidgets
parent88fff87519e741a3a999b8c1545834d116859faa (diff)
Tests: Fix some space-related flake8 warnings
Change-Id: I9b0ad08839bf1246620c557ec304dfa90882907b Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/tests/QtWidgets')
-rw-r--r--sources/pyside6/tests/QtWidgets/action_clear.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/add_action_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/api2_test.py11
-rw-r--r--sources/pyside6/tests/QtWidgets/application_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1002.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1006.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1077.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_243.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_307.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_324.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_338.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_389.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_400.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_430.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_433.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_467.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_493.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_512.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_525.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_546.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_547.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_549.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_569.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_575.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_585.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_589.py18
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_635.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_640.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_653.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_662.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_667.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_668.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_674.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_688.py11
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_693.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_696.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_711.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_722.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_728.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_750.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_778.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_785.py9
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_793.py9
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_811.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_834.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_836.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_844.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_854.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_860.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_862.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_871.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_879.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_919.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_921.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_941.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_964.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_967.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_972.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_979.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_988.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_998.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/customproxywidget_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/event_filter_test.py10
-rw-r--r--sources/pyside6/tests/QtWidgets/grandparent_method_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/hashabletype_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/keep_reference_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/missing_symbols_test.py15
-rw-r--r--sources/pyside6/tests/QtWidgets/paint_event_test.py13
-rw-r--r--sources/pyside6/tests/QtWidgets/parent_method_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/private_mangle_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/python_properties_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qaction_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qapp_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qapplication_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qbrush_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qdynamic_signal.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qfontdialog_test.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/qformlayout_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py8
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py55
-rw-r--r--sources/pyside6/tests/QtWidgets/qimage_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qlabel_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_ref_test.py26
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_test.py14
-rw-r--r--sources/pyside6/tests/QtWidgets/qlcdnumber_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qlistwidget_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qmainwindow_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qmenu_test.py11
-rw-r--r--sources/pyside6/tests/QtWidgets/qmenuadd_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qobject_mi_test.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/qpen_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qpicture_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qpixmap_constructor.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qpushbutton_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qshortcut_test.py10
-rw-r--r--sources/pyside6/tests/QtWidgets/qsplitter_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py14
-rw-r--r--sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qstyle_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtableview_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qtabwidget_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qtextedit_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbar_test.py8
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbox_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreeview_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreewidget_test.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/qvariant_test.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qwidget_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/reference_count_test.py12
-rw-r--r--sources/pyside6/tests/QtWidgets/signature_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/standardpixmap_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/test_module_template.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py12
-rw-r--r--sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/wrong_return_test.py1
126 files changed, 409 insertions, 172 deletions
diff --git a/sources/pyside6/tests/QtWidgets/action_clear.py b/sources/pyside6/tests/QtWidgets/action_clear.py
index ae5a6988b..f9f416a9c 100644
--- a/sources/pyside6/tests/QtWidgets/action_clear.py
+++ b/sources/pyside6/tests/QtWidgets/action_clear.py
@@ -77,5 +77,6 @@ class TestQActionLifeCycle(UsesQApplication):
toolBar.clear()
self.assertTrue(self._actionDestroyed)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/add_action_test.py b/sources/pyside6/tests/QtWidgets/add_action_test.py
index 1465f5a99..1260f4e17 100644
--- a/sources/pyside6/tests/QtWidgets/add_action_test.py
+++ b/sources/pyside6/tests/QtWidgets/add_action_test.py
@@ -74,6 +74,7 @@ class AddActionTest(UsesQApplication):
action.activate(QAction.Trigger)
self.assertTrue(widget.isChecked())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/api2_test.py b/sources/pyside6/tests/QtWidgets/api2_test.py
index cd60d8a4d..c71de90d3 100644
--- a/sources/pyside6/tests/QtWidgets/api2_test.py
+++ b/sources/pyside6/tests/QtWidgets/api2_test.py
@@ -45,11 +45,13 @@ from PySide6.QtWidgets import QWidget, QSpinBox, QApplication
from helper.usesqapplication import UsesQApplication
+
class WidgetValidatorQInt(QWidget, QIntValidator):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
QIntValidator.__init__(self, parent)
+
class WidgetValidatorQSpinBox(QSpinBox):
def __init__(self, parent=None):
QSpinBox.__init__(self, parent)
@@ -57,6 +59,7 @@ class WidgetValidatorQSpinBox(QSpinBox):
def fixup(self, text):
print("It was called!")
+
class DoubleQObjectInheritanceTest(UsesQApplication):
def testDouble(self):
@@ -64,7 +67,7 @@ class DoubleQObjectInheritanceTest(UsesQApplication):
obj = WidgetValidatorQInt()
- #QIntValidator methods
+ # QIntValidator methods
state, string, number = obj.validate('Test', 0)
self.assertEqual(state, QValidator.Invalid)
state, string, number = obj.validate('33', 0)
@@ -77,11 +80,12 @@ class DoubleQObjectInheritanceTest(UsesQApplication):
obj.setValue(0)
self.assertEqual(obj.value(), 1)
+
class QClipboardTest(UsesQApplication):
def testQClipboard(self):
- #skip this test on MacOS because the clipboard is not available during the ssh session
- #this cause problems in the buildbot
+ # skip this test on macOS because the clipboard is not available during the ssh session
+ # this cause problems in the buildbot
if sys.platform == 'darwin':
return
clip = QApplication.clipboard()
@@ -91,5 +95,6 @@ class QClipboardTest(UsesQApplication):
self.assertEqual(subtype, "plain")
self.assertEqual(text, "Testing this thing!")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/application_test.py b/sources/pyside6/tests/QtWidgets/application_test.py
index 95f36f671..2fea0286b 100644
--- a/sources/pyside6/tests/QtWidgets/application_test.py
+++ b/sources/pyside6/tests/QtWidgets/application_test.py
@@ -41,6 +41,7 @@ from testbinding import TestObject
from PySide6.QtWidgets import QApplication
from PySide6 import __all__ as all
+
class QApplicationInstance(unittest.TestCase):
def appDestroyed(self):
@@ -61,6 +62,7 @@ class QApplicationInstance(unittest.TestCase):
# self.assertEqual(app1, qApp)
app1.destroyed.connect(self.appDestroyed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_1002.py b/sources/pyside6/tests/QtWidgets/bug_1002.py
index 3bf85e718..ab9cee147 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1002.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1002.py
@@ -39,6 +39,7 @@ from PySide6.QtWidgets import QWidget, QPushButton
from helper.usesqapplication import UsesQApplication
+
class TestBug1002 (UsesQApplication):
def testReturnWindow(self):
widget = QWidget()
@@ -50,5 +51,6 @@ class TestBug1002 (UsesQApplication):
del widget
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_1006.py b/sources/pyside6/tests/QtWidgets/bug_1006.py
index 96231ddc3..7aaff11c1 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1006.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1006.py
@@ -41,6 +41,7 @@ from PySide6.QtWidgets import QDialog, QLabel, QGridLayout, QHBoxLayout, QWidget
from helper.timedqapplication import TimedQApplication
+
class LabelWindow(QDialog):
def __init__(self, parent):
super().__init__(parent)
@@ -51,7 +52,6 @@ class LabelWindow(QDialog):
self.setLayout(self.test_layout)
self._destroyCalled = False
-
def replace(self, unit):
old_item = self.test_layout.itemAtPosition(0, 0)
old_label = old_item.widget()
@@ -69,6 +69,7 @@ class LabelWindow(QDialog):
def _destroyed(self, obj):
self._destroyCalled = True
+
class TestBug1006 (TimedQApplication):
def testLayoutItemLifeTime(self):
@@ -113,5 +114,6 @@ class TestBug1006 (TimedQApplication):
widget.setObjectName("MyWidget")
self.assertEqual(sys.getrefcount(widget), 3)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_1077.py b/sources/pyside6/tests/QtWidgets/bug_1077.py
index 4c35e16bb..8aed4e6f5 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1077.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1077.py
@@ -47,6 +47,7 @@ class Highlighter(QSyntaxHighlighter):
super().__init__(parent)
self.tstamp = time.time()
+
if __name__ == "__main__":
app = QApplication([])
python = QTextEdit()
diff --git a/sources/pyside6/tests/QtWidgets/bug_243.py b/sources/pyside6/tests/QtWidgets/bug_243.py
index 9a551b88d..dea27888c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_243.py
+++ b/sources/pyside6/tests/QtWidgets/bug_243.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication, QMainWindow, QLayout
+
class QAppPresence(unittest.TestCase):
def testBug(self):
@@ -47,5 +48,6 @@ class QAppPresence(unittest.TestCase):
l = window.layout()
self.assertTrue(isinstance(l, QLayout))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_307.py b/sources/pyside6/tests/QtWidgets/bug_307.py
index 19da5148e..92b0a5973 100644
--- a/sources/pyside6/tests/QtWidgets/bug_307.py
+++ b/sources/pyside6/tests/QtWidgets/bug_307.py
@@ -40,8 +40,8 @@ from PySide6.QtCore import SIGNAL
from PySide6.QtWidgets import QPushButton, QApplication
-class Test (QApplication) :
- def __init__(self, argv) :
+class Test (QApplication):
+ def __init__(self, argv):
super().__init__(argv)
self._called = False
@@ -57,5 +57,6 @@ class QApplicationSignalsTest(unittest.TestCase):
button.click()
self.assertTrue(app._called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_324.py b/sources/pyside6/tests/QtWidgets/bug_324.py
index 2f59b6c23..b3336923f 100644
--- a/sources/pyside6/tests/QtWidgets/bug_324.py
+++ b/sources/pyside6/tests/QtWidgets/bug_324.py
@@ -41,8 +41,8 @@ from PySide6.QtCore import QObject, Signal
from PySide6.QtWidgets import QApplication
-class QBug( QObject ):
- def __init__(self, parent = None):
+class QBug(QObject):
+ def __init__(self, parent=None):
QObject.__init__(self, parent)
def check(self):
@@ -50,6 +50,7 @@ class QBug( QObject ):
done = Signal(str)
+
class Bug324(unittest.TestCase):
def on_done(self, val):
@@ -63,5 +64,6 @@ class Bug324(unittest.TestCase):
bug.check()
self.assertEqual(self.value, 'abc')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_338.py b/sources/pyside6/tests/QtWidgets/bug_338.py
index 329a6746c..c47179473 100644
--- a/sources/pyside6/tests/QtWidgets/bug_338.py
+++ b/sources/pyside6/tests/QtWidgets/bug_338.py
@@ -54,9 +54,10 @@ class BugTest(unittest.TestCase):
scene = QGraphicsScene()
item = DiagramItem()
item2 = DiagramItem()
- #this cause segfault
+ # this cause segfault
scene.addItem(item)
scene.addItem(item2)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_389.py b/sources/pyside6/tests/QtWidgets/bug_389.py
index 3b0ca6a54..4cef736b4 100644
--- a/sources/pyside6/tests/QtWidgets/bug_389.py
+++ b/sources/pyside6/tests/QtWidgets/bug_389.py
@@ -48,5 +48,6 @@ class BugTest(UsesQApplication):
i = s.standardIcon(QStyle.SP_TitleBarMinButton)
self.assertEqual(type(i), QIcon)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_400.py b/sources/pyside6/tests/QtWidgets/bug_400.py
index 7f067a09a..39eafd23a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_400.py
+++ b/sources/pyside6/tests/QtWidgets/bug_400.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QTreeWidgetItemIterator, QTreeWidgetItem, QTreeWidget
+
class BugTest(UsesQApplication):
def testCase(self):
treeWidget = QTreeWidget()
@@ -48,7 +49,7 @@ class BugTest(UsesQApplication):
for i in range(10):
items.append(QTreeWidgetItem(None, [f"item: {i}"]))
- treeWidget.insertTopLevelItems(0, items);
+ treeWidget.insertTopLevelItems(0, items)
_iter = QTreeWidgetItemIterator(treeWidget)
index = 0
while(_iter.value()):
diff --git a/sources/pyside6/tests/QtWidgets/bug_430.py b/sources/pyside6/tests/QtWidgets/bug_430.py
index 7eecd650d..0d3e3a09a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_430.py
+++ b/sources/pyside6/tests/QtWidgets/bug_430.py
@@ -40,9 +40,10 @@ from PySide6.QtWidgets import QApplication, QListView
class ListModel(QAbstractListModel):
- def rowCount(self, parent = QModelIndex()):
+ def rowCount(self, parent=QModelIndex()):
return 0
+
app = QApplication([])
model = ListModel()
v = QListView()
diff --git a/sources/pyside6/tests/QtWidgets/bug_433.py b/sources/pyside6/tests/QtWidgets/bug_433.py
index 0cae07435..0c109f40a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_433.py
+++ b/sources/pyside6/tests/QtWidgets/bug_433.py
@@ -45,6 +45,7 @@ class Test(QGraphicsView):
self.s = QGraphicsScene()
self.setScene(self.s)
+
a = QApplication(sys.argv)
t = Test()
t.show()
diff --git a/sources/pyside6/tests/QtWidgets/bug_467.py b/sources/pyside6/tests/QtWidgets/bug_467.py
index d3bc98230..eaa2696d2 100644
--- a/sources/pyside6/tests/QtWidgets/bug_467.py
+++ b/sources/pyside6/tests/QtWidgets/bug_467.py
@@ -40,8 +40,9 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QMainWindow, QApplication
+
class MyWidget(QMainWindow):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
@@ -51,5 +52,6 @@ class BugTest(UsesQApplication):
widgets = QApplication.allWidgets()
self.assertTrue(w in widgets)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_493.py b/sources/pyside6/tests/QtWidgets/bug_493.py
index 7a2442f9d..52aae39da 100644
--- a/sources/pyside6/tests/QtWidgets/bug_493.py
+++ b/sources/pyside6/tests/QtWidgets/bug_493.py
@@ -53,5 +53,6 @@ class TestBug493(unittest.TestCase):
self.assertTrue(ev1.matches(ks))
self.assertFalse(ev2.matches(ks))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_512.py b/sources/pyside6/tests/QtWidgets/bug_512.py
index 46dadfa57..d93999833 100644
--- a/sources/pyside6/tests/QtWidgets/bug_512.py
+++ b/sources/pyside6/tests/QtWidgets/bug_512.py
@@ -44,7 +44,7 @@ from PySide6.QtWidgets import QGridLayout, QLabel, QWidget
class BugTest(UsesQApplication):
def testCase(self):
w = QWidget(None)
- lbl = QLabel("Hello", w);
+ lbl = QLabel("Hello", w)
g = QGridLayout()
g.addWidget(lbl, 0, 0)
w.setLayout(g)
@@ -52,7 +52,8 @@ class BugTest(UsesQApplication):
t = g.getItemPosition(0)
self.assertEqual(type(t), tuple)
- self.assertEqual(t, (0,0,1,1))
+ self.assertEqual(t, (0, 0, 1, 1))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_525.py b/sources/pyside6/tests/QtWidgets/bug_525.py
index 573e9bf46..e86c03ba8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_525.py
+++ b/sources/pyside6/tests/QtWidgets/bug_525.py
@@ -38,11 +38,13 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication
from PySide6.QtWidgets import QMenu
+
class M2(QMenu):
- def __init__(self,parent=None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.setTitle(self.tr("M2"))
+
class TestMenuDerivedClass(unittest.TestCase):
def aboutToShowHandler(self):
pass
@@ -53,5 +55,6 @@ class TestMenuDerivedClass(unittest.TestCase):
# Test if the aboutToShow signal was translated to correct type
m2.aboutToShow.connect(self.aboutToShowHandler)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_546.py b/sources/pyside6/tests/QtWidgets/bug_546.py
index 9fece8cd4..4d4f9ed16 100644
--- a/sources/pyside6/tests/QtWidgets/bug_546.py
+++ b/sources/pyside6/tests/QtWidgets/bug_546.py
@@ -47,5 +47,6 @@ class TestBug546(unittest.TestCase):
completer = QCompleter(("foo", "bar"), textEdit)
completer.setWidget(textEdit)
-if __name__=='__main__':
+
+if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_547.py b/sources/pyside6/tests/QtWidgets/bug_547.py
index 0753e932e..984a0c858 100644
--- a/sources/pyside6/tests/QtWidgets/bug_547.py
+++ b/sources/pyside6/tests/QtWidgets/bug_547.py
@@ -44,6 +44,7 @@ from PySide6.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem
class MyMainWindow(unittest.TestCase):
app = QApplication(sys.argv)
+
def testCase1(self):
self._tree = QTreeWidget()
self._tree.setColumnCount(2)
@@ -88,6 +89,7 @@ class MyMainWindow(unittest.TestCase):
self._i11 = QTreeWidgetItem(self._i1, ['11', ])
self.assertEqual(sys.getrefcount(self._i11), 3)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_549.py b/sources/pyside6/tests/QtWidgets/bug_549.py
index dee5d8315..30c56a9a8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_549.py
+++ b/sources/pyside6/tests/QtWidgets/bug_549.py
@@ -47,6 +47,7 @@ class TestBug549(unittest.TestCase):
w.setWindowFrameMargins(5, 6, 7, 8)
self.assertEqual(w.getWindowFrameMargins(), (5, 6, 7, 8))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_569.py b/sources/pyside6/tests/QtWidgets/bug_569.py
index 12809853b..cd4874403 100644
--- a/sources/pyside6/tests/QtWidgets/bug_569.py
+++ b/sources/pyside6/tests/QtWidgets/bug_569.py
@@ -44,11 +44,12 @@ class TestBug569(unittest.TestCase):
types = (QTableWidgetItem, QListWidgetItem, QTreeWidgetItem)
for t in types:
a = t()
- a.__lt__ = lambda other : True
+ a.__lt__ = lambda other: True
b = t()
- b.__lt__ = lambda other : False
+ b.__lt__ = lambda other: False
self.assertTrue(a < b)
self.assertFalse(b < a)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_575.py b/sources/pyside6/tests/QtWidgets/bug_575.py
index d6de17dd1..b7318eded 100644
--- a/sources/pyside6/tests/QtWidgets/bug_575.py
+++ b/sources/pyside6/tests/QtWidgets/bug_575.py
@@ -52,6 +52,7 @@ class Bug575(unittest.TestCase):
selection.cursor.setPosition(2)
self.assertEqual(selection.cursor.position(), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_585.py b/sources/pyside6/tests/QtWidgets/bug_585.py
index eeb89c297..82d581af9 100644
--- a/sources/pyside6/tests/QtWidgets/bug_585.py
+++ b/sources/pyside6/tests/QtWidgets/bug_585.py
@@ -56,6 +56,7 @@ class Bug585(unittest.TestCase):
self.assertEqual(refCount, sys.getrefcount(i1))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_589.py b/sources/pyside6/tests/QtWidgets/bug_589.py
index 48faae17e..6b4afc74b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_589.py
+++ b/sources/pyside6/tests/QtWidgets/bug_589.py
@@ -41,15 +41,17 @@ from PySide6.QtWidgets import QApplication, QGraphicsProxyWidget
class CustomWidget(QGraphicsProxyWidget):
- def itemChange(self, eventType, value):
- QGraphicsProxyWidget.itemChange(self, eventType, value)
+ def itemChange(self, eventType, value):
+ QGraphicsProxyWidget.itemChange(self, eventType, value)
+
class Bug589(unittest.TestCase):
- def testCase(self):
- widget = QGraphicsProxyWidget()
- custom = CustomWidget()
- custom.setParentItem(widget)
+ def testCase(self):
+ widget = QGraphicsProxyWidget()
+ custom = CustomWidget()
+ custom.setParentItem(widget)
+
if __name__ == "__main__":
- app = QApplication(sys.argv)
- unittest.main()
+ app = QApplication(sys.argv)
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_635.py b/sources/pyside6/tests/QtWidgets/bug_635.py
index 7cce5b32a..2def84299 100644
--- a/sources/pyside6/tests/QtWidgets/bug_635.py
+++ b/sources/pyside6/tests/QtWidgets/bug_635.py
@@ -60,6 +60,7 @@ class testQToolBar(unittest.TestCase):
a.trigger()
self.assertTrue(self._called)
+
if __name__ == '__main__':
app = QApplication(sys.argv)
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_640.py b/sources/pyside6/tests/QtWidgets/bug_640.py
index 965adc3a5..b050cf69b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_640.py
+++ b/sources/pyside6/tests/QtWidgets/bug_640.py
@@ -41,7 +41,8 @@ from PySide6.QtWidgets import QStyleOptionGraphicsItem
class Bug640(unittest.TestCase):
def testIt(self):
option = QStyleOptionGraphicsItem()
- a = option.state # crash!?
+ a = option.state # crash!?
+
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_653.py b/sources/pyside6/tests/QtWidgets/bug_653.py
index 47d310a44..3412caa31 100644
--- a/sources/pyside6/tests/QtWidgets/bug_653.py
+++ b/sources/pyside6/tests/QtWidgets/bug_653.py
@@ -46,8 +46,9 @@ class TestBug653(unittest.TestCase):
wizard = QWizard()
page = QWizardPage()
wizard.addPage(page)
- page.wizard() # crash here if the bug still exists due to a circular dependency
+ page.wizard() # crash here if the bug still exists due to a circular dependency
wizard.show()
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_662.py b/sources/pyside6/tests/QtWidgets/bug_662.py
index cc36c6c99..ebc91697b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_662.py
+++ b/sources/pyside6/tests/QtWidgets/bug_662.py
@@ -40,6 +40,7 @@ from PySide6.QtGui import QTextCharFormat
from PySide6.QtWidgets import QTextEdit, QApplication
import sys
+
class testQTextBlock(unittest.TestCase):
def tesIterator(self):
edit = QTextEdit()
@@ -47,8 +48,8 @@ class testQTextBlock(unittest.TestCase):
fmt = QTextCharFormat()
frags = []
for i in range(10):
- fmt.setFontPointSize(i+10)
- frags.append("block%d"%i)
+ fmt.setFontPointSize(i + 10)
+ frags.append(f"block{i}")
cursor.insertText(frags[i], fmt)
doc = edit.document()
@@ -59,6 +60,7 @@ class testQTextBlock(unittest.TestCase):
self.assertEqual(i.fragment().text(), frags[index])
index += 1
+
if __name__ == '__main__':
app = QApplication(sys.argv)
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_667.py b/sources/pyside6/tests/QtWidgets/bug_667.py
index 3cad4e11a..42f9dade3 100644
--- a/sources/pyside6/tests/QtWidgets/bug_667.py
+++ b/sources/pyside6/tests/QtWidgets/bug_667.py
@@ -38,10 +38,12 @@ init_test_paths()
from PySide6.QtCore import QTimer, QPointF
from PySide6.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsEllipseItem
+
class Ball(QGraphicsEllipseItem):
def __init__(self, d, parent=None):
super().__init__(0, 0, d, d, parent)
- self.vel = QPointF(0,0) #commenting this out prevents the crash
+ self.vel = QPointF(0, 0) #commenting this out prevents the crash
+
class Foo(QGraphicsView):
def __init__(self):
diff --git a/sources/pyside6/tests/QtWidgets/bug_668.py b/sources/pyside6/tests/QtWidgets/bug_668.py
index 167a19ce6..09456756c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_668.py
+++ b/sources/pyside6/tests/QtWidgets/bug_668.py
@@ -53,6 +53,7 @@ class A(QMainWindow):
# Test index() method (see PYSIDE-570, PYSIDE-331)
index = a.index(0, 0, QModelIndex())
+
app = QApplication([])
m = A()
m.show()
diff --git a/sources/pyside6/tests/QtWidgets/bug_674.py b/sources/pyside6/tests/QtWidgets/bug_674.py
index 94ae27212..95e32edd1 100644
--- a/sources/pyside6/tests/QtWidgets/bug_674.py
+++ b/sources/pyside6/tests/QtWidgets/bug_674.py
@@ -51,7 +51,8 @@ class TestBug679(unittest.TestCase):
scene.clear()
self.assertEqual(sys.getrefcount(hello), 2)
self.assertEqual(len(scene.items()), 0)
- self.assertRaises(RuntimeError, hello.isVisible) # the C++ object was deleted
+ self.assertRaises(RuntimeError, hello.isVisible) # the C++ object was deleted
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_688.py b/sources/pyside6/tests/QtWidgets/bug_688.py
index 4b1bfbd73..1120c38f6 100644
--- a/sources/pyside6/tests/QtWidgets/bug_688.py
+++ b/sources/pyside6/tests/QtWidgets/bug_688.py
@@ -41,6 +41,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QTextFrame, QTextCursor, QTextCharFormat, QFont, QTextFrameFormat
from PySide6.QtWidgets import QTextEdit
+
class BugTest(UsesQApplication):
def testCase(self):
editor = QTextEdit()
@@ -51,7 +52,7 @@ class BugTest(UsesQApplication):
plainCharFormat = QTextCharFormat()
boldCharFormat = QTextCharFormat()
- boldCharFormat.setFontWeight(QFont.Bold);
+ boldCharFormat.setFontWeight(QFont.Bold)
cursor.insertText("""
Text documents are represented by the
QTextDocument class, rather than by QString objects.
@@ -91,16 +92,15 @@ class BugTest(UsesQApplication):
manipulation of the document's contents.""",
plainCharFormat)
-
frame = cursor.currentFrame()
items = []
- #test iterator
+ # test iterator
for i in frame:
items.append(i)
- #test __iadd__
+ # test __iadd__
b = frame.begin()
i = 0
while not b.atEnd():
@@ -109,7 +109,7 @@ class BugTest(UsesQApplication):
b.__iadd__(1)
i += 1
- #test __isub__
+ # test __isub__
b = frame.end()
i = 0
while i > 0:
@@ -119,6 +119,5 @@ class BugTest(UsesQApplication):
i -= 1
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_693.py b/sources/pyside6/tests/QtWidgets/bug_693.py
index 9f5b0f068..dea191aaf 100644
--- a/sources/pyside6/tests/QtWidgets/bug_693.py
+++ b/sources/pyside6/tests/QtWidgets/bug_693.py
@@ -49,6 +49,7 @@ class MyModel (QAbstractListModel):
def data(self, index, role):
return self.stupidLine
+
class TestBug693(unittest.TestCase):
def testIt(self):
app = QApplication([])
@@ -62,6 +63,5 @@ class TestBug693(unittest.TestCase):
MyModel.stupidLine.isNull()
-
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_696.py b/sources/pyside6/tests/QtWidgets/bug_696.py
index f7f4f6d90..e59b87bc0 100644
--- a/sources/pyside6/tests/QtWidgets/bug_696.py
+++ b/sources/pyside6/tests/QtWidgets/bug_696.py
@@ -40,14 +40,17 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QMainWindow, QMenu, QApplication
+
class MainWindow(QMainWindow):
def __init__(self, *args):
- self._menu = QMenu(self.dontexist) # attribute called with invalid C++ object
+ self._menu = QMenu(self.dontexist) # attribute called with invalid C++ object
+
class MainWindow2(QMainWindow):
def __init__(self):
self.show()
+
class Bug696(UsesQApplication):
def testContructorInitialization(self):
self.assertRaises(AttributeError, MainWindow)
diff --git a/sources/pyside6/tests/QtWidgets/bug_711.py b/sources/pyside6/tests/QtWidgets/bug_711.py
index e78fe85b6..9f6217379 100644
--- a/sources/pyside6/tests/QtWidgets/bug_711.py
+++ b/sources/pyside6/tests/QtWidgets/bug_711.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtGui import QAction
from PySide6.QtWidgets import QToolBar, QApplication, QToolButton
+
class TestLabelPixmap(unittest.TestCase):
def testReference(self):
toolbar = QToolBar()
@@ -51,6 +52,7 @@ class TestLabelPixmap(unittest.TestCase):
for b in buttons:
self.assertRaises(RuntimeError, b.objectName)
+
if __name__ == '__main__':
app = QApplication([])
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_722.py b/sources/pyside6/tests/QtWidgets/bug_722.py
index 4a00e035d..968e2c2dd 100644
--- a/sources/pyside6/tests/QtWidgets/bug_722.py
+++ b/sources/pyside6/tests/QtWidgets/bug_722.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QDoubleSpinBox, QGraphicsBlurEffect
+
class TestSignalConnection(UsesQApplication):
def testFloatSignal(self):
foo1 = QDoubleSpinBox()
@@ -51,9 +52,10 @@ class TestSignalConnection(UsesQApplication):
def testQRealSignal(self):
foo1 = QDoubleSpinBox()
effect = QGraphicsBlurEffect()
- effect.blurRadiusChanged['qreal'].connect(foo1.setValue) # check if qreal is a valid type
+ effect.blurRadiusChanged['qreal'].connect(foo1.setValue) # check if qreal is a valid type
effect.setBlurRadius(0.42)
self.assertAlmostEqual(foo1.value(), effect.blurRadius())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_728.py b/sources/pyside6/tests/QtWidgets/bug_728.py
index 9e1473635..4d1b37593 100644
--- a/sources/pyside6/tests/QtWidgets/bug_728.py
+++ b/sources/pyside6/tests/QtWidgets/bug_728.py
@@ -41,6 +41,8 @@ from PySide6.QtCore import QDir, QTimer
# Periodically check for the file dialog to appear and close it
dialog = None
+
+
def timerHandler():
global dialog
if dialog is not None:
@@ -48,10 +50,11 @@ def timerHandler():
else:
for widget in QApplication.topLevelWidgets():
if isinstance(widget, QDialog) and widget.isVisible():
- dialog = widget
+ dialog = widget
+
app = QApplication([])
-QTimer.singleShot(30000, app.quit) # emergency
+QTimer.singleShot(30000, app.quit) # emergency
timer = QTimer()
timer.setInterval(50)
timer.timeout.connect(timerHandler)
diff --git a/sources/pyside6/tests/QtWidgets/bug_750.py b/sources/pyside6/tests/QtWidgets/bug_750.py
index 1c96e3e1f..111204bf9 100644
--- a/sources/pyside6/tests/QtWidgets/bug_750.py
+++ b/sources/pyside6/tests/QtWidgets/bug_750.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import QTimer
from PySide6.QtGui import QPainter, QFont, QFontInfo
from PySide6.QtWidgets import QWidget
+
class MyWidget(QWidget):
def paintEvent(self, e):
p = QPainter(self)
@@ -57,5 +58,6 @@ class TestQPainter(UsesQApplication):
self.app.exec_()
self.assertTrue(w._info)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_778.py b/sources/pyside6/tests/QtWidgets/bug_778.py
index fc52ce705..5fbbd07fa 100644
--- a/sources/pyside6/tests/QtWidgets/bug_778.py
+++ b/sources/pyside6/tests/QtWidgets/bug_778.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QTreeWidget, QTreeWidgetItem, QTreeWidgetItemIterator
+
class QTreeWidgetItemIteratorTest(UsesQApplication):
def testWidgetIterator(self):
treeWidget = QTreeWidget()
@@ -53,5 +54,6 @@ class QTreeWidgetItemIteratorTest(UsesQApplication):
self.assertEqual(it.value().text(0), f'item: {index}')
index += 1
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_785.py b/sources/pyside6/tests/QtWidgets/bug_785.py
index 27b552e3c..019dbc0cb 100644
--- a/sources/pyside6/tests/QtWidgets/bug_785.py
+++ b/sources/pyside6/tests/QtWidgets/bug_785.py
@@ -38,11 +38,13 @@ init_test_paths(False)
from PySide6.QtCore import QItemSelection
from PySide6.QtGui import QStandardItemModel, QStandardItem
from PySide6.QtWidgets import QApplication
+
+
class Bug324(unittest.TestCase):
def testOperators(self):
model = QStandardItemModel()
for i in range(100):
- model.appendRow(QStandardItem("Item: %d"%i))
+ model.appendRow(QStandardItem(f"Item: {i}"))
first = model.index(0, 0)
second = model.index(10, 0)
@@ -53,12 +55,13 @@ class Bug324(unittest.TestCase):
sel2 = QItemSelection()
sel2.select(third, fourth)
- sel3 = sel + sel2 #check operator +
+ sel3 = sel + sel2 # check operator +
self.assertEqual(len(sel3), 2)
sel4 = sel
- sel4 += sel2 #check operator +=
+ sel4 += sel2 # check operator +=
self.assertEqual(len(sel4), 2)
self.assertEqual(sel4, sel3)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_793.py b/sources/pyside6/tests/QtWidgets/bug_793.py
index 08c060f15..40e3f85da 100644
--- a/sources/pyside6/tests/QtWidgets/bug_793.py
+++ b/sources/pyside6/tests/QtWidgets/bug_793.py
@@ -38,27 +38,32 @@ init_test_paths(False)
from PySide6.QtCore import QTimer
from PySide6.QtWidgets import QWidget, QApplication
+
class TestW1(QWidget):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__(parent)
TestW2(parent, self)
+
class TestW2(QWidget):
- def __init__(self, ancestor, parent = None):
+ def __init__(self, ancestor, parent=None):
super().__init__(parent)
self.ancestor_ref = ancestor
+
class Test(QWidget):
def __init__(self):
super().__init__()
TestW1(self)
+
class TestQApplicationDestrcutor(unittest.TestCase):
def testDestructor(self):
w = Test()
w.show()
QTimer.singleShot(0, w.close)
+
if __name__ == '__main__':
app = QApplication(sys.argv)
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_811.py b/sources/pyside6/tests/QtWidgets/bug_811.py
index cde5f2fe9..38fbd652c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_811.py
+++ b/sources/pyside6/tests/QtWidgets/bug_811.py
@@ -41,11 +41,13 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QTextBlockUserData, QTextCursor
from PySide6.QtWidgets import QTextEdit
+
class TestUserData(QTextBlockUserData):
def __init__(self, data):
super().__init__()
self.data = data
+
class TestUserDataRefCount(UsesQApplication):
def testRefcount(self):
textedit = QTextEdit()
@@ -63,5 +65,6 @@ class TestUserDataRefCount(UsesQApplication):
del ud, ud2
self.assertEqual(sys.getrefcount(self.udata()), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_834.py b/sources/pyside6/tests/QtWidgets/bug_834.py
index 3a3926359..a8a6ab107 100644
--- a/sources/pyside6/tests/QtWidgets/bug_834.py
+++ b/sources/pyside6/tests/QtWidgets/bug_834.py
@@ -43,6 +43,7 @@ class Window(QMainWindow):
def childEvent(self, event):
super(Window, self).childEvent(event)
+
app = QApplication([])
window = Window()
diff --git a/sources/pyside6/tests/QtWidgets/bug_836.py b/sources/pyside6/tests/QtWidgets/bug_836.py
index 4523c525c..fe381a570 100644
--- a/sources/pyside6/tests/QtWidgets/bug_836.py
+++ b/sources/pyside6/tests/QtWidgets/bug_836.py
@@ -42,16 +42,20 @@ from PySide6.QtWidgets import QApplication, QFrame
class Mixin1(object):
pass
+
class Mixin2(object):
pass
+
class Mixin3(object):
pass
+
class MainWindow(Mixin1, Mixin2, Mixin3, QFrame):
def __init__(self):
super().__init__()
+
def main():
app = QApplication([])
# if it doesn't crash it should pass
@@ -60,6 +64,7 @@ def main():
QTimer.singleShot(0, w.close)
app.exec_()
+
if __name__ == "__main__":
main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_844.py b/sources/pyside6/tests/QtWidgets/bug_844.py
index 879c08850..e6167dfc6 100644
--- a/sources/pyside6/tests/QtWidgets/bug_844.py
+++ b/sources/pyside6/tests/QtWidgets/bug_844.py
@@ -47,6 +47,7 @@ class QtKeyPressListener(QObject):
# This used to crash here due to a misbehaviour of type discovery!
return QObject.eventFilter(self, obj, event)
+
app = QApplication([])
key_listener = QtKeyPressListener(app)
w = QLabel('Hello')
diff --git a/sources/pyside6/tests/QtWidgets/bug_854.py b/sources/pyside6/tests/QtWidgets/bug_854.py
index 6ce2b653e..5c88237b5 100644
--- a/sources/pyside6/tests/QtWidgets/bug_854.py
+++ b/sources/pyside6/tests/QtWidgets/bug_854.py
@@ -56,7 +56,7 @@ class VirtualList(QAbstractItemModel):
return self.createIndex(row, column)
def parent(self, index):
- return QModelIndex()
+ return QModelIndex()
def data(self, index, role):
row = index.row()
@@ -73,6 +73,7 @@ class TestQAbstractItemModel(UsesQApplication):
table.show()
self.assertFalse(model._getItemCalled)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_860.py b/sources/pyside6/tests/QtWidgets/bug_860.py
index 4a208257a..b5ce9419d 100644
--- a/sources/pyside6/tests/QtWidgets/bug_860.py
+++ b/sources/pyside6/tests/QtWidgets/bug_860.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QCheckBox
from helper.usesqapplication import UsesQApplication
+
class MultipleSlotTest(UsesQApplication):
def cb_changed(self, i):
self._changed = True
@@ -65,5 +66,6 @@ class MultipleSlotTest(UsesQApplication):
box.setChecked(True)
self.assertTrue(self._changed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_862.py b/sources/pyside6/tests/QtWidgets/bug_862.py
index 643b338e7..d16357081 100644
--- a/sources/pyside6/tests/QtWidgets/bug_862.py
+++ b/sources/pyside6/tests/QtWidgets/bug_862.py
@@ -66,18 +66,22 @@ class MyQObject(QObject):
def __init__(self):
super().__init__()
+
class MyQWidget(QWidget):
def __init__(self):
super().__init__()
+
class MyQGraphicsObject(QGraphicsObject):
def __init__(self):
super().__init__()
+
class MyQGraphicsItem(QGraphicsItem):
def __init__(self):
super().__init__()
+
class TestRepr (unittest.TestCase):
def testIt(self):
@@ -94,5 +98,6 @@ class TestRepr (unittest.TestCase):
self.assertEqual("<PySide6.QtWidgets.QWidget(0x", repr(QWidget())[:29])
self.assertEqual("<PySide6.QtWidgets.QGraphicsWidget(0x", repr(QGraphicsWidget())[:37])
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_871.py b/sources/pyside6/tests/QtWidgets/bug_871.py
index 758d3ece4..487f46494 100644
--- a/sources/pyside6/tests/QtWidgets/bug_871.py
+++ b/sources/pyside6/tests/QtWidgets/bug_871.py
@@ -43,11 +43,11 @@ from PySide6.QtWidgets import QLineEdit
class BlankIntValidator(QIntValidator):
- def validate(self,input,pos):
+ def validate(self, input, pos):
if input == '':
return QValidator.Acceptable, input, pos
else:
- return QIntValidator.validate(self,input,pos)
+ return QIntValidator.validate(self, input, pos)
class Bug871Test(UsesQApplication):
@@ -74,5 +74,5 @@ class Bug871Test(UsesQApplication):
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_879.py b/sources/pyside6/tests/QtWidgets/bug_879.py
index 4089fa590..8a7b4b184 100644
--- a/sources/pyside6/tests/QtWidgets/bug_879.py
+++ b/sources/pyside6/tests/QtWidgets/bug_879.py
@@ -39,10 +39,12 @@ from PySide6.QtCore import QCoreApplication, QTimer, QEvent, Qt
from PySide6.QtWidgets import QApplication, QSpinBox
from PySide6.QtGui import QKeyEvent
+
class MySpinBox(QSpinBox):
- def validate(self,text,pos):
- return QSpinBox.validate(self,text,pos)
+ def validate(self, text, pos):
+ return QSpinBox.validate(self, text, pos)
+
class TestBug879 (unittest.TestCase):
@@ -61,5 +63,6 @@ class TestBug879 (unittest.TestCase):
ev = QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, 'a')
QCoreApplication.sendEvent(self.box, ev)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_919.py b/sources/pyside6/tests/QtWidgets/bug_919.py
index fd51ec9ef..f4d5311fd 100644
--- a/sources/pyside6/tests/QtWidgets/bug_919.py
+++ b/sources/pyside6/tests/QtWidgets/bug_919.py
@@ -40,8 +40,9 @@ from PySide6.QtCore import Signal, QTimer
from PySide6.QtGui import QPainter
from PySide6.QtWidgets import QPushButton, QStyleOptionButton, QApplication, QStyle
+
class MyWidget(QPushButton):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QPushButton.__init__(self, parent)
self._painted = False
@@ -58,6 +59,7 @@ class MyWidget(QPushButton):
paintReceived = Signal()
+
class TestBug919(TimedQApplication):
def setUp(self):
TimedQApplication.setUp(self, 2000)
@@ -69,5 +71,6 @@ class TestBug919(TimedQApplication):
self.app.exec_()
self.assertTrue(w._painted)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_921.py b/sources/pyside6/tests/QtWidgets/bug_921.py
index 9c7924efb..d27ce774d 100644
--- a/sources/pyside6/tests/QtWidgets/bug_921.py
+++ b/sources/pyside6/tests/QtWidgets/bug_921.py
@@ -47,6 +47,7 @@ class Signaller(QObject):
s2 = Signal()
s3 = Signal()
+
class Window(object):
def __init__(self, s):
@@ -64,6 +65,7 @@ class Window(object):
def _on_signal(self):
self._window.setWindowTitle("Signaled!")
+
class TestTimedApp(TimedQApplication):
def testSignals(self):
s = Signaller()
@@ -83,5 +85,6 @@ class TestTimedApp(TimedQApplication):
s.s2.emit()
s.s3.emit()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_941.py b/sources/pyside6/tests/QtWidgets/bug_941.py
index 459659931..6f200b281 100644
--- a/sources/pyside6/tests/QtWidgets/bug_941.py
+++ b/sources/pyside6/tests/QtWidgets/bug_941.py
@@ -42,13 +42,15 @@ from PySide6.QtWidgets import QApplication, QHeaderView
def foo(a, b):
pass
+
class TestBug941 (unittest.TestCase):
def testIt(self):
app = QApplication([])
view = QHeaderView(Qt.Horizontal)
self.assertTrue(view.sortIndicatorChanged.connect(foo))
- view.sortIndicatorChanged.emit(0, Qt.Vertical) # this can't raise an exception!
+ view.sortIndicatorChanged.emit(0, Qt.Vertical) # this can't raise an exception!
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_964.py b/sources/pyside6/tests/QtWidgets/bug_964.py
index 8a3ea9434..fdf74e324 100644
--- a/sources/pyside6/tests/QtWidgets/bug_964.py
+++ b/sources/pyside6/tests/QtWidgets/bug_964.py
@@ -46,10 +46,11 @@ class TestBug964 (unittest.TestCase):
model = QStringListModel(["1", "2"])
view = QListView()
view.setModel(model)
- view.setCurrentIndex(model.index(0,0))
+ view.setCurrentIndex(model.index(0, 0))
newCursor = view.moveCursor(QAbstractItemView.MoveDown, Qt.NoModifier)
self.assertEqual(newCursor.row(), 1)
self.assertEqual(newCursor.column(), 0)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_967.py b/sources/pyside6/tests/QtWidgets/bug_967.py
index b86715002..a27a046d3 100644
--- a/sources/pyside6/tests/QtWidgets/bug_967.py
+++ b/sources/pyside6/tests/QtWidgets/bug_967.py
@@ -51,5 +51,6 @@ class TestBug967 (unittest.TestCase):
obj.currentIndexChanged.emit(5)
self.assertEqual(self.arg, 5)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_972.py b/sources/pyside6/tests/QtWidgets/bug_972.py
index 12110edee..24f892f19 100644
--- a/sources/pyside6/tests/QtWidgets/bug_972.py
+++ b/sources/pyside6/tests/QtWidgets/bug_972.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QGraphicsProxyWidget, QSizePolicy, QPushButton, QG
from helper.timedqapplication import TimedQApplication
+
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
@@ -51,6 +52,7 @@ def createItem(minimum, preferred, maximum, name):
return w
+
class TestBug972 (TimedQApplication):
# Test if the function QGraphicsProxyWidget.setWidget have the correct behavior
diff --git a/sources/pyside6/tests/QtWidgets/bug_979.py b/sources/pyside6/tests/QtWidgets/bug_979.py
index aa2a610a6..e6607d260 100644
--- a/sources/pyside6/tests/QtWidgets/bug_979.py
+++ b/sources/pyside6/tests/QtWidgets/bug_979.py
@@ -37,9 +37,10 @@ init_test_paths()
from PySide6.QtWidgets import QDialog
from import_test import PysideImportTest2
+
class PysideImportTest1(QDialog, PysideImportTest2):
- pass
+ pass
+
if __name__ == '__main__':
quit()
-
diff --git a/sources/pyside6/tests/QtWidgets/bug_988.py b/sources/pyside6/tests/QtWidgets/bug_988.py
index 9d3f0398d..02bc9f741 100644
--- a/sources/pyside6/tests/QtWidgets/bug_988.py
+++ b/sources/pyside6/tests/QtWidgets/bug_988.py
@@ -51,5 +51,6 @@ class TestBug988 (unittest.TestCase):
obj.currentChanged.emit(5)
self.assertEqual(self.arg, 5)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_998.py b/sources/pyside6/tests/QtWidgets/bug_998.py
index 735de74bc..0cea3296b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_998.py
+++ b/sources/pyside6/tests/QtWidgets/bug_998.py
@@ -37,10 +37,12 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication
+
class TestBug998 (unittest.TestCase):
def testNoFocusWindow(self):
widget = QApplication.focusWidget()
self.assertTrue(widget == None)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
index d63391125..db4da7884 100644
--- a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
@@ -41,10 +41,12 @@ from PySide6.QtGui import QPainter
from PySide6.QtWidgets import QLabel
from PySide6.QtWidgets import QGraphicsScene, QGraphicsView, QGraphicsItem, QGraphicsProxyWidget
+
class CustomProxy(QGraphicsProxyWidget):
def __init__(self, parent=None, wFlags=0):
QGraphicsProxyWidget.__init__(self, parent, wFlags)
+
class CustomProxyWidgetTest(UsesQApplication):
def testCustomProxyWidget(self):
scene = QGraphicsScene()
@@ -57,13 +59,14 @@ class CustomProxyWidgetTest(UsesQApplication):
scene.setSceneRect(scene.itemsBoundingRect())
view = QGraphicsView(scene)
- view.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform)
+ view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.show()
timer = QTimer.singleShot(100, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/event_filter_test.py b/sources/pyside6/tests/QtWidgets/event_filter_test.py
index 37333506f..aee5a2926 100644
--- a/sources/pyside6/tests/QtWidgets/event_filter_test.py
+++ b/sources/pyside6/tests/QtWidgets/event_filter_test.py
@@ -39,11 +39,12 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QObject, QEvent
from PySide6.QtWidgets import QWidget
+
class MyFilter(QObject):
- def eventFilter(self, obj, event):
- if event.type() == QEvent.KeyPress:
- pass
- return QObject.eventFilter(self, obj, event)
+ def eventFilter(self, obj, event):
+ if event.type() == QEvent.KeyPress:
+ pass
+ return QObject.eventFilter(self, obj, event)
class EventFilter(UsesQApplication):
@@ -69,5 +70,6 @@ class EventFilter(UsesQApplication):
w = None
self.assertTrue(True)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
index b1a8742d0..67d56e156 100644
--- a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
+++ b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
@@ -41,17 +41,20 @@ from PySide6.QtWidgets import QPushButton, QWidget
from helper.usesqapplication import UsesQApplication
+
class Dummy(QPushButton):
def show(self):
QWidget.show(self)
self.called = True
+
class GrandParentMethod(UsesQApplication):
def testMethod(self):
obj = Dummy()
obj.show()
self.assertTrue(obj.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/hashabletype_test.py b/sources/pyside6/tests/QtWidgets/hashabletype_test.py
index 93eba5486..4a56a1045 100644
--- a/sources/pyside6/tests/QtWidgets/hashabletype_test.py
+++ b/sources/pyside6/tests/QtWidgets/hashabletype_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QTreeWidgetItem
from helper.usesqapplication import UsesQApplication
+
class HashableTest(UsesQApplication):
def testQTreeWidgetItemHash(self):
@@ -48,6 +49,7 @@ class HashableTest(UsesQApplication):
h[obj] = 2
self.assertTrue(h.get(obj), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/keep_reference_test.py b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
index 87ab45ec4..1766f16ee 100644
--- a/sources/pyside6/tests/QtWidgets/keep_reference_test.py
+++ b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
@@ -46,13 +46,17 @@ from PySide6.QtWidgets import QTableView
class TestModel(QAbstractTableModel):
def __init__(self, parent=None):
QAbstractTableModel.__init__(self, parent)
+
def rowCount(self, parent):
return 0
+
def columnCount(self, parent):
return 0
+
def data(self, index, role):
return None
+
class KeepReferenceTest(UsesQApplication):
def testModelWithoutParent(self):
@@ -106,6 +110,7 @@ class KeepReferenceTest(UsesQApplication):
createModelAndSetToView(view)
model = view.model()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
index a4b0cb12d..d30f77fc5 100644
--- a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
+++ b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
@@ -40,26 +40,29 @@ init_test_paths(False)
from PySide6 import QtGui
from PySide6 import QtWidgets
+
class MissingClasses(unittest.TestCase):
- def testQDrag(self): # Bug 222
+ def testQDrag(self): # Bug 222
getattr(QtGui, 'QDrag')
- def testQDropEvent(self): # Bug 255
+ def testQDropEvent(self): # Bug 255
getattr(QtGui, 'QDropEvent')
+
class MissingMembers(unittest.TestCase):
- def testQFontMetricsSize(self): # Bug 223
+ def testQFontMetricsSize(self): # Bug 223
QtGui.QFontMetrics.size
- def testQLayoutSetSpacing(self): # Bug 231
+ def testQLayoutSetSpacing(self): # Bug 231
QtWidgets.QLayout.setSpacing
- def testQImageLoad(self): # Bug 257
+ def testQImageLoad(self): # Bug 257
QtGui.QImage.load
- def testQStandardItemModelinsertRow(self): # Bug 227
+ def testQStandardItemModelinsertRow(self): # Bug 227
QtGui.QStandardItemModel.insertRow
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/paint_event_test.py b/sources/pyside6/tests/QtWidgets/paint_event_test.py
index ed5c56eee..48d999901 100644
--- a/sources/pyside6/tests/QtWidgets/paint_event_test.py
+++ b/sources/pyside6/tests/QtWidgets/paint_event_test.py
@@ -42,11 +42,12 @@ from PySide6.QtWidgets import QApplication, QWidget
from helper.usesqapplication import UsesQApplication
+
class MyWidget(QWidget):
'''Sample widget'''
def __init__(self, app=None):
- #Creates a new widget
+ # Creates a new widget
if app is None:
app = QApplication([])
@@ -57,7 +58,7 @@ class MyWidget(QWidget):
self.paint_event_called = False
def timerEvent(self, event):
- #Timer event method
+ # Timer event method
self.runs += 1
if self.runs == self.max_runs:
@@ -67,7 +68,7 @@ class MyWidget(QWidget):
raise TypeError('Invalid event type. Must be QTimerEvent')
def paintEvent(self, event):
- #Empty paint event method
+ # Empty paint event method
# XXX: should be using super here, but somehow PyQt4
# complains about paintEvent not present in super
QWidget.paintEvent(self, event)
@@ -80,17 +81,17 @@ class PaintEventOverride(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(PaintEventOverride, self).setUp()
self.widget = MyWidget(self.app)
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget
super(PaintEventOverride, self).tearDown()
def testPaintEvent(self):
- #Test QWidget.paintEvent override
+ # Test QWidget.paintEvent override
timer_id = self.widget.startTimer(100)
self.widget.show()
self.app.exec_()
diff --git a/sources/pyside6/tests/QtWidgets/parent_method_test.py b/sources/pyside6/tests/QtWidgets/parent_method_test.py
index 56b109531..4f2ab2f9a 100644
--- a/sources/pyside6/tests/QtWidgets/parent_method_test.py
+++ b/sources/pyside6/tests/QtWidgets/parent_method_test.py
@@ -43,8 +43,10 @@ class Foo(QTableView):
def __init__(self, parent=None):
QTableView.__init__(self, parent)
+
from helper.usesqapplication import UsesQApplication
+
class TestParentType(UsesQApplication):
def testParentType(self):
@@ -56,5 +58,6 @@ class TestParentType(UsesQApplication):
self.assertTrue(isinstance(w2.parentWidget(), Foo))
self.assertTrue(isinstance(w2.parent(), Foo))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/private_mangle_test.py b/sources/pyside6/tests/QtWidgets/private_mangle_test.py
index bfa11c350..94bbfa231 100644
--- a/sources/pyside6/tests/QtWidgets/private_mangle_test.py
+++ b/sources/pyside6/tests/QtWidgets/private_mangle_test.py
@@ -55,6 +55,7 @@ from PySide6.QtCore import Signal
from PySide6.QtWidgets import QApplication, QWidget
from PySide6 import QtWidgets
+
class Harness(QWidget):
clicked = Signal()
diff --git a/sources/pyside6/tests/QtWidgets/python_properties_test.py b/sources/pyside6/tests/QtWidgets/python_properties_test.py
index 4c90dce28..72adc7517 100644
--- a/sources/pyside6/tests/QtWidgets/python_properties_test.py
+++ b/sources/pyside6/tests/QtWidgets/python_properties_test.py
@@ -51,5 +51,6 @@ class Properties(unittest.TestCase):
# PSYIDE-304, can assign to a "const QWidget *" field
p.widget = None
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
index 7bbdedadd..b6d443bdb 100644
--- a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
@@ -40,6 +40,7 @@ from PySide6.QtGui import QTextFormat, QTextCharFormat, QPyTextObject
from PySide6.QtWidgets import QTextEdit
from helper.usesqapplication import UsesQApplication
+
class Foo(QPyTextObject):
called = False
@@ -50,6 +51,7 @@ class Foo(QPyTextObject):
def drawObject(self, painter, rect, doc, posInDocument, format):
pass
+
class QAbstractTextDocumentLayoutTest(UsesQApplication):
objectType = QTextFormat.UserObject + 1
@@ -76,6 +78,7 @@ class QAbstractTextDocumentLayoutTest(UsesQApplication):
self.assertTrue(Foo.called)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qaction_test.py b/sources/pyside6/tests/QtWidgets/qaction_test.py
index 42130a598..6f9b1afec 100644
--- a/sources/pyside6/tests/QtWidgets/qaction_test.py
+++ b/sources/pyside6/tests/QtWidgets/qaction_test.py
@@ -39,6 +39,7 @@ from PySide6.QtGui import QAction
from PySide6.QtWidgets import QWidget
from helper.usesqapplication import UsesQApplication
+
class QPainterDrawText(UsesQApplication):
def _cb(self):
@@ -72,6 +73,7 @@ class SetShortcutTest(UsesQApplication):
s2 = action.shortcut()
self.assertEqual(s2, shortcut)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qapp_test.py b/sources/pyside6/tests/QtWidgets/qapp_test.py
index 0455cdb61..dec6034f1 100644
--- a/sources/pyside6/tests/QtWidgets/qapp_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapp_test.py
@@ -43,12 +43,14 @@ from PySide6.QtWidgets import QApplication
class QAppPresence(unittest.TestCase):
def testQApp(self):
- #QtGui.qApp variable is instance of QApplication
+ # QtGui.qApp variable is instance of QApplication
self.assertTrue(isinstance(qApp, QApplication))
+
def main():
app = QApplication([])
unittest.main()
+
if __name__ == '__main__':
main()
diff --git a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
index 4008aa743..57b1e410a 100644
--- a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
@@ -37,14 +37,16 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication, QPushButton, QWidget, QSpinBox
+
class QApplicationDelete(unittest.TestCase):
'''Test for segfault when deleting a QApplication before a QWidget'''
def testQPushButton(self):
- #QApplication deleted before QPushButton
+ # QApplication deleted before QPushButton
a = QApplication([])
b = QPushButton('aaaa')
del a
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qapplication_test.py b/sources/pyside6/tests/QtWidgets/qapplication_test.py
index 4c5c56dfa..4d62f8179 100644
--- a/sources/pyside6/tests/QtWidgets/qapplication_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapplication_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication
+
class TestQApplication(unittest.TestCase):
def testNoArguments(self):
app = QApplication()
diff --git a/sources/pyside6/tests/QtWidgets/qbrush_test.py b/sources/pyside6/tests/QtWidgets/qbrush_test.py
index 838bfc9e5..2083a6c56 100644
--- a/sources/pyside6/tests/QtWidgets/qbrush_test.py
+++ b/sources/pyside6/tests/QtWidgets/qbrush_test.py
@@ -43,11 +43,12 @@ from PySide6.QtWidgets import QApplication
from helper.usesqapplication import UsesQApplication
+
class Constructor(UsesQApplication):
'''Test case for constructor of QBrush'''
def testQColor(self):
- #QBrush(QColor) constructor
+ # QBrush(QColor) constructor
color = QColor('black')
obj = QBrush(color)
self.assertEqual(obj.color(), color)
@@ -55,5 +56,6 @@ class Constructor(UsesQApplication):
obj = QBrush(Qt.blue)
self.assertEqual(obj.color(), Qt.blue)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
index d1fe42151..89caf2906 100644
--- a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
+++ b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QInputDialog
from helper.usesqapplication import UsesQApplication
+
class DynamicSignalTest(UsesQApplication):
def cb(self, obj):
diff --git a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
index 59c5dca3b..c503873ad 100644
--- a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
+++ b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
@@ -46,11 +46,11 @@ class TestFontDialog(TimedQApplication):
QFontDialog.getFont()
def testGetFontQDialog(self):
- QFontDialog.getFont(QFont("FreeSans",10))
+ QFontDialog.getFont(QFont("FreeSans", 10))
def testGetFontQDialogQString(self):
- QFontDialog.getFont(QFont("FreeSans",10), None, "Select font")
+ QFontDialog.getFont(QFont("FreeSans", 10), None, "Select font")
+
if __name__ == '__main__':
unittest.main()
-
diff --git a/sources/pyside6/tests/QtWidgets/qformlayout_test.py b/sources/pyside6/tests/QtWidgets/qformlayout_test.py
index 15cb7432f..1bb89d61c 100644
--- a/sources/pyside6/tests/QtWidgets/qformlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qformlayout_test.py
@@ -39,6 +39,7 @@ from PySide6.QtWidgets import QFormLayout, QWidget
from helper.usesqapplication import UsesQApplication
+
class QFormLayoutTest(UsesQApplication):
def testGetItemPosition(self):
@@ -88,5 +89,5 @@ class QFormLayoutTest(UsesQApplication):
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
index ed9485d0d..2ee6cd96f 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
@@ -62,5 +62,6 @@ class QGraphicsViewIsBlockedTest(UsesQApplication):
(first, second) = Item().isBlockedByModalPanel()
self.assertFalse(first)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
index 583a54709..4ce395e0e 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
@@ -42,11 +42,12 @@ from PySide6.QtWidgets import QGraphicsScene
from helper.usesqapplication import UsesQApplication
+
class QColorOnSetBrush(UsesQApplication):
'''Test case for passing a QColor directly to setBrush'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(QColorOnSetBrush, self).setUp()
self.scene = QGraphicsScene()
@@ -55,16 +56,17 @@ class QColorOnSetBrush(UsesQApplication):
self.color = QColor('black')
def tearDown(self):
- #Release resources
+ # Release resources
del self.color
del self.item
del self.scene
super(QColorOnSetBrush, self).tearDown()
def testQColor(self):
- #QGraphicsAbstractShapeItem.setBrush(QColor)
+ # QGraphicsAbstractShapeItem.setBrush(QColor)
self.item.setBrush(self.color)
self.assertEqual(QBrush(self.color), self.item.brush())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
index f7ec876bb..92d89b44d 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
@@ -42,6 +42,7 @@ from PySide6.QtCore import QRectF
from helper.usesqapplication import UsesQApplication
+
class GObjA(QGraphicsObject):
def paint(self, *args):
pass
@@ -52,6 +53,7 @@ class GObjA(QGraphicsObject):
def itemChange(self, *args):
return QGraphicsObject.itemChange(self, *args)
+
class GObjB(QGraphicsObject):
def paint(self, *args):
pass
@@ -59,6 +61,7 @@ class GObjB(QGraphicsObject):
def boundingRect(self):
return QRectF()
+
class QGraphicsObjectReimpl(UsesQApplication):
'''Test case for reimplementing QGraphicsObject'''
@@ -79,5 +82,6 @@ class QGraphicsObjectReimpl(UsesQApplication):
gobjB.setParentItem(w)
self.assertIs(type(w), type(gobjB.parentItem()))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
index b4e62bc13..ef78f83f7 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
@@ -41,6 +41,7 @@ from PySide6.QtGui import QPainter
from PySide6.QtWidgets import QLabel
from PySide6.QtWidgets import QGraphicsScene, QGraphicsView, QGraphicsItem, QGraphicsProxyWidget
+
class QGraphicsProxyWidgetTest(UsesQApplication):
def testQGraphicsProxyWidget(self):
scene = QGraphicsScene()
@@ -53,13 +54,14 @@ class QGraphicsProxyWidgetTest(UsesQApplication):
scene.setSceneRect(scene.itemsBoundingRect())
view = QGraphicsView(scene)
- view.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform)
+ view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.show()
timer = QTimer.singleShot(100, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
index 54e81c45c..b8a5a3945 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
@@ -50,19 +50,22 @@ from PySide6.QtWidgets import QGraphicsProxyWidget, QGraphicsView
from helper.usesqapplication import UsesQApplication
+
class Constructor(unittest.TestCase):
'''QGraphicsScene constructor'''
def testConstructor(self):
- #QGraphicsScene constructor
+ # QGraphicsScene constructor
obj = QGraphicsScene()
self.assertTrue(isinstance(obj, QGraphicsScene))
# Test for PYSIDE-868: Test whether painter.device() can be accessed
# correctly. This was crashing when the underlying QPaintDevice was a
# QWidget due to handling multiple inheritance incorrectly.
+
+
class CustomScene(QGraphicsScene):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.dpi = 0
@@ -72,24 +75,25 @@ class CustomScene(QGraphicsScene):
def drawForeground(self, painter, rect):
self.dpi = painter.device().physicalDpiX()
+
class ConstructorWithRect(unittest.TestCase):
'''QGraphicsScene qrect constructor and related sizes'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
# PyQt4 doesn't accept a QRect as argument to constructor
self.scene = QGraphicsScene(0, 200, 150, 175)
def tearDown(self):
- #Release resources
+ # Release resources
del self.scene
def testHeight(self):
- #QGraphicsScene.height()
+ # QGraphicsScene.height()
self.assertEqual(self.scene.height(), 175)
def testWidth(self):
- #QGraphicsScene.width()
+ # QGraphicsScene.width()
self.assertEqual(self.scene.width(), 150)
@@ -99,60 +103,60 @@ class AddItem(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(AddItem, self).setUp()
self.scene = QGraphicsScene()
# While the scene does not inherits from QWidget, requires
# an application to make the internals work.
def tearDown(self):
- #Release resources
+ # Release resources
del self.scene
super(AddItem, self).tearDown()
def testEllipse(self):
- #QGraphicsScene.addEllipse
+ # QGraphicsScene.addEllipse
item = self.scene.addEllipse(100, 100, 100, 100)
self.assertTrue(isinstance(item, QGraphicsEllipseItem))
def testLine(self):
- #QGraphicsScene.addLine
+ # QGraphicsScene.addLine
item = self.scene.addLine(100, 100, 200, 200)
self.assertTrue(isinstance(item, QGraphicsLineItem))
def testPath(self):
- #QGraphicsScene.addPath
+ # QGraphicsScene.addPath
item = self.scene.addPath(QPainterPath())
self.assertTrue(isinstance(item, QGraphicsPathItem))
def testPixmap(self):
- #QGraphicsScene.addPixmap
+ # QGraphicsScene.addPixmap
item = self.scene.addPixmap(QPixmap())
self.assertTrue(isinstance(item, QGraphicsPixmapItem))
def testPolygon(self):
- #QGraphicsScene.addPolygon
+ # QGraphicsScene.addPolygon
points = [QPointF(0, 0), QPointF(100, 100), QPointF(0, 100)]
item = self.scene.addPolygon(QPolygonF(points))
self.assertTrue(isinstance(item, QGraphicsPolygonItem))
def testRect(self):
- #QGraphicsScene.addRect
+ # QGraphicsScene.addRect
item = self.scene.addRect(100, 100, 100, 100)
self.assertTrue(isinstance(item, QGraphicsRectItem))
def testSimpleText(self):
- #QGraphicsScene.addSimpleText
+ # QGraphicsScene.addSimpleText
item = self.scene.addSimpleText('Monty Python 42')
self.assertTrue(isinstance(item, QGraphicsSimpleTextItem))
def testText(self):
- #QGraphicsScene.addText
+ # QGraphicsScene.addText
item = self.scene.addText('Monty Python 42')
self.assertTrue(isinstance(item, QGraphicsTextItem))
def testWidget(self):
- #QGraphicsScene.addWidget
+ # QGraphicsScene.addWidget
# XXX: printing some X11 error when using under PyQt4
item = self.scene.addWidget(QPushButton())
self.assertTrue(isinstance(item, QGraphicsProxyWidget))
@@ -164,7 +168,7 @@ class ItemRetrieve(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(ItemRetrieve, self).setUp()
self.scene = QGraphicsScene()
@@ -174,29 +178,30 @@ class ItemRetrieve(UsesQApplication):
self.bottomright = QGraphicsRectItem(100, 100, 100, 100)
self.items = [self.topleft, self.topright, self.bottomleft,
- self.bottomright]
+ self.bottomright]
for item in self.items:
self.scene.addItem(item)
def tearDown(self):
- #Release resources
+ # Release resources
del self.scene
super(ItemRetrieve, self).tearDown()
def testItems(self):
- #QGraphicsScene.items()
+ # QGraphicsScene.items()
items = self.scene.items()
for i in items:
self.assertTrue(i in self.items)
def testItemAt(self):
- #QGraphicsScene.itemAt()
+ # QGraphicsScene.itemAt()
self.assertEqual(self.scene.itemAt(50, 50, QTransform()), self.topleft)
self.assertEqual(self.scene.itemAt(150, 50, QTransform()), self.topright)
self.assertEqual(self.scene.itemAt(50, 150, QTransform()), self.bottomleft)
self.assertEqual(self.scene.itemAt(150, 150, QTransform()), self.bottomright)
+
class TestGraphicsGroup(UsesQApplication):
def testIt(self):
scene = QGraphicsScene()
@@ -207,17 +212,17 @@ class TestGraphicsGroup(UsesQApplication):
i4 = QGraphicsRectItem()
group = scene.createItemGroup((i2, i3, i4))
scene.removeItem(i1)
- del i1 # this shouldn't delete i2
+ del i1 # this shouldn't delete i2
self.assertEqual(i2.scene(), scene)
scene.destroyItemGroup(group)
self.assertRaises(RuntimeError, group.type)
- def testCustomScene(self): # For PYSIDE-868, see above
+ def testCustomScene(self): # For PYSIDE-868, see above
scene = CustomScene()
view = QGraphicsView(scene)
view.show()
while scene.dpi == 0:
- QApplication.instance().processEvents()
+ QApplication.processEvents()
view.hide()
diff --git a/sources/pyside6/tests/QtWidgets/qimage_test.py b/sources/pyside6/tests/QtWidgets/qimage_test.py
index 73c8ba4ce..216126df9 100644
--- a/sources/pyside6/tests/QtWidgets/qimage_test.py
+++ b/sources/pyside6/tests/QtWidgets/qimage_test.py
@@ -274,6 +274,7 @@ xpm = [
". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + "
]
+
class QImageTest(UsesQApplication):
'''Test case for calling setPixel with float as argument'''
@@ -307,6 +308,7 @@ class QImageTest(UsesQApplication):
self.assertEqual(img.width(), 27)
self.assertEqual(img.height(), 22)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
index df3307d77..c558e291b 100644
--- a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
+++ b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
@@ -53,7 +53,8 @@ class TestInputDialog(TimedQApplication):
def testGetText(self):
(text, bool) = QInputDialog.getText(None, "title", "label")
- self.assertEqual(str(text),"")
+ self.assertEqual(str(text), "")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
index 61f56f2d2..cd629430f 100644
--- a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
+++ b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
@@ -42,6 +42,7 @@ from PySide6.QtWidgets import QKeySequenceEdit
from helper.usesqapplication import UsesQApplication
+
class QKeySequenceEditTest(UsesQApplication):
def testKeySequence(self):
keySequenceEdit = QKeySequenceEdit()
@@ -50,5 +51,6 @@ class QKeySequenceEditTest(UsesQApplication):
self.app.exec_()
print(keySequenceEdit.keySequence())
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlabel_test.py b/sources/pyside6/tests/QtWidgets/qlabel_test.py
index 15618eec7..b8bbb2902 100644
--- a/sources/pyside6/tests/QtWidgets/qlabel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlabel_test.py
@@ -43,6 +43,7 @@ from shiboken6 import Shiboken
from helper.usesqapplication import UsesQApplication
+
class QLabelTest(UsesQApplication):
'''Test case for calling QLabel.setPixmap'''
@@ -62,7 +63,6 @@ class QLabelTest(UsesQApplication):
self.label.setPixmap(p1)
self.assertIsNotNone(self.label.pixmap())
-
# PYSIDE-150:
# When a new QPixmap is assigned to a QLabel,
# the previous one needs to be cleared.
@@ -85,5 +85,6 @@ class QLabelTest(UsesQApplication):
self.assertTrue(all(Shiboken.getCppPointer(o) != ret_p_addr
for o in Shiboken.getAllValidWrappers()))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
index d10141098..255119562 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
@@ -44,6 +44,7 @@ from PySide6.QtWidgets import QApplication, QPushButton, QLabel
from helper.usesqapplication import UsesQApplication
+
class SaveReference(UsesQApplication):
'''Test case to check if QLayout-derived classes increment the refcount
of widgets passed to addWidget()'''
@@ -52,19 +53,19 @@ class SaveReference(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(SaveReference, self).setUp()
self.widget1 = QPushButton('click me')
self.widget2 = QLabel('aaa')
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget2
del self.widget1
super(SaveReference, self).tearDown()
def checkLayoutReference(self, layout):
- #Checks the reference cound handling of layout.addWidget
+ # Checks the reference cound handling of layout.addWidget
self.assertEqual(getrefcount(self.widget1), 2)
layout.addWidget(self.widget1)
self.assertEqual(getrefcount(self.widget1), 3)
@@ -86,32 +87,32 @@ class SaveReference(UsesQApplication):
w.setLayout(l)
self.assertEqual(getrefcount(self.widget1), 3)
-
def testHBoxReference(self):
- #QHBoxLayout.addWidget reference count
+ # QHBoxLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QHBoxLayout(w))
def testVBoxReference(self):
- #QVBoxLayout.addWidget reference count
+ # QVBoxLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QVBoxLayout(w))
def testGridReference(self):
- #QGridLayout.addWidget reference count
+ # QGridLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QGridLayout(w))
def testFormReference(self):
- #QFormLayout.addWidget reference count
+ # QFormLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QFormLayout(w))
def testStackedReference(self):
- #QStackedLayout.addWidget reference count
+ # QStackedLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QStackedLayout(w))
+
class MultipleAdd(UsesQApplication):
'''Test case to check if refcount is incremented only once when multiple
calls to addWidget are made with the same widget'''
@@ -119,21 +120,21 @@ class MultipleAdd(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(MultipleAdd, self).setUp()
self.widget = QPushButton('click me')
self.win = QWidget()
self.layout = QHBoxLayout(self.win)
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget
del self.layout
del self.win
super(MultipleAdd, self).tearDown()
def testRefCount(self):
- #Multiple QLayout.addWidget calls on the same widget
+ # Multiple QLayout.addWidget calls on the same widget
self.assertEqual(getrefcount(self.widget), 2)
self.layout.addWidget(self.widget)
self.assertEqual(getrefcount(self.widget), 3)
@@ -142,6 +143,7 @@ class MultipleAdd(UsesQApplication):
self.layout.addWidget(self.widget)
self.assertEqual(getrefcount(self.widget), 3)
+
class InternalAdd(UsesQApplication):
def testInternalRef(self):
mw = QWidget()
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_test.py b/sources/pyside6/tests/QtWidgets/qlayout_test.py
index 012d84da1..fa5e53e4f 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_test.py
@@ -64,6 +64,7 @@ class MyLayout(QLayout):
def add(self, item):
self._list.append(item)
+
class MissingItemAtLayout(QLayout):
def __init__(self, parent=None):
QLayout.__init__(self, parent)
@@ -81,10 +82,11 @@ class MissingItemAtLayout(QLayout):
def add(self, item):
self._list.append(item)
-#Test if a layout implemented in python, the QWidget.setLayout works
-#fine because this implement som layout functions used in glue code of
-#QWidget, then in c++ when call a virtual function this need call the QLayout
-#function implemented in python
+# Test if a layout implemented in python, the QWidget.setLayout works
+# fine because this implement som layout functions used in glue code of
+# QWidget, then in c++ when call a virtual function this need call the QLayout
+# function implemented in python
+
class QLayoutTest(UsesQApplication):
def testOwnershipTransfer(self):
@@ -97,12 +99,11 @@ class QLayoutTest(UsesQApplication):
w = QWidget()
- #transfer ref
+ # transfer ref
w.setLayout(l)
self.assertEqual(sys.getrefcount(b), 3)
-
def testReferenceTransfer(self):
b = QPushButton("teste")
l = QHBoxLayout()
@@ -144,5 +145,6 @@ class QLayoutTest(UsesQApplication):
del w
self.assertRaises(RuntimeError, spacer.isEmpty)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
index 55b289e2c..fb7c4b578 100644
--- a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication, QLCDNumber
+
class QLCDNumberOverflow(unittest.TestCase):
'''Test case for unhandled overflow on QLCDNumber() numDigits argument (see bug #215).'''
@@ -47,5 +48,6 @@ class QLCDNumberOverflow(unittest.TestCase):
# NOTE: PyQt4 raises TypeError, but boost.python raises OverflowError
self.assertRaises(OverflowError, QLCDNumber, 840835495615213080)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
index 5ca2507e9..64fc2f181 100644
--- a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
@@ -48,7 +48,7 @@ class QListWidgetTest(UsesQApplication):
item = QListWidgetItem("item0")
item.setData(Qt.UserRole, o)
- #item._data = o
+ # item._data = o
self.assertTrue(sys.getrefcount(o), 3)
self.assertTrue(sys.getrefcount(item), 2)
lst.addItem(item)
@@ -79,7 +79,7 @@ class QListWidgetTest(UsesQApplication):
def testIt(self):
lst = QListWidget()
lst.show()
- slot = lambda : lst.removeItemWidget(lst.currentItem())
+ slot = lambda: lst.removeItemWidget(lst.currentItem())
lst.addItem(QListWidgetItem("foo"))
QTimer.singleShot(0, slot)
QTimer.singleShot(0, lst.close)
@@ -93,5 +93,6 @@ class QListWidgetTest(UsesQApplication):
self.assertIsNone(lst.clear())
self.assertRaises(RuntimeError, lambda: item.text())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
index 7cfbfe3d1..5bfdcf496 100644
--- a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
@@ -59,5 +59,6 @@ class QListWidgetItemConstructor(UsesQApplication):
# Bug 452 - QListWidgetItem() not casting NoneType to null correctly.
item = QListWidgetItem(None, 123)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
index 4ed726eb4..017ffbbd0 100644
--- a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
@@ -52,6 +52,7 @@ class MainWindow(QMainWindow):
pointerToolbar = self.addToolBar("Pointer type")
pointerToolbar.addWidget(pointerButton)
+
class MyButton(QPushButton):
def __init__(self, parent=None):
super().__init__()
diff --git a/sources/pyside6/tests/QtWidgets/qmenu_test.py b/sources/pyside6/tests/QtWidgets/qmenu_test.py
index 20d43069b..0033cd35d 100644
--- a/sources/pyside6/tests/QtWidgets/qmenu_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmenu_test.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import SLOT
from helper.usesqapplication import UsesQApplication
+
class QMenuAddAction(UsesQApplication):
def setUp(self):
@@ -53,17 +54,18 @@ class QMenuAddAction(UsesQApplication):
def testAddActionWithoutKeySequenceCallable(self):
# bug #280
- action = self.menu.addAction(self.app.tr('aaa'), lambda : 1)
+ action = self.menu.addAction(self.app.tr('aaa'), lambda: 1)
def testAddActionKeySequenceCallable(self):
# bug #228
- action = self.menu.addAction(self.app.tr('aaa'), lambda : 1,
+ action = self.menu.addAction(self.app.tr('aaa'), lambda: 1,
QKeySequence(self.app.tr('Ctrl+O')))
def testAddActionKeySequenceSlot(self):
action = self.menu.addAction('Quit', self.app, SLOT('quit()'),
QKeySequence('Ctrl+O'))
+
class QMenuAddActionWithIcon(UsesQApplication):
def setUp(self):
@@ -78,16 +80,17 @@ class QMenuAddActionWithIcon(UsesQApplication):
def testAddActionWithoutKeySequenceCallable(self):
# bug #280
- action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda : 1)
+ action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda: 1)
def testAddActionKeySequenceCallable(self):
# bug #228
- action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda : 1,
+ action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda: 1,
QKeySequence(self.app.tr('Ctrl+O')))
def testAddActionKeySequenceSlot(self):
action = self.menu.addAction(self.icon, 'Quit', self.app, SLOT('quit()'),
QKeySequence('Ctrl+O'))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
index cbe738e53..c7f2ff74f 100644
--- a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
@@ -55,5 +55,6 @@ class QMenuAddAction(UsesQApplication):
addNewAction.trigger()
self.assertEqual(self.arg, ())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
index 6251f757c..169ee5279 100644
--- a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
+++ b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
@@ -59,15 +59,15 @@ class DoubleQObjectInheritanceTest(UsesQApplication):
obj = WidgetValidator()
- #QObject methods
+ # QObject methods
obj.setObjectName('aaaa')
self.assertEqual(obj.objectName(), 'aaaa')
- #QWidget methods
+ # QWidget methods
obj.setVisible(False)
self.assertFalse(obj.isVisible())
- #QIntValidator methods
+ # QIntValidator methods
state, string, number = obj.validate('aaaa', 0)
self.assertEqual(state, QValidator.Invalid)
state, string, number = obj.validate('33', 0)
diff --git a/sources/pyside6/tests/QtWidgets/qpen_test.py b/sources/pyside6/tests/QtWidgets/qpen_test.py
index c833ebd92..2707fc931 100644
--- a/sources/pyside6/tests/QtWidgets/qpen_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpen_test.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QPen, QPainter
from PySide6.QtWidgets import QWidget
+
class Painting(QWidget):
def __init__(self):
super().__init__()
diff --git a/sources/pyside6/tests/QtWidgets/qpicture_test.py b/sources/pyside6/tests/QtWidgets/qpicture_test.py
index c8f485142..06364e4be 100644
--- a/sources/pyside6/tests/QtWidgets/qpicture_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpicture_test.py
@@ -40,18 +40,20 @@ from PySide6.QtCore import QTimer
from PySide6.QtGui import QPicture, QPainter
from PySide6.QtWidgets import QWidget
+
class MyWidget(QWidget):
def paintEvent(self, e):
p = QPainter(self)
p.drawPicture(0, 0, self._picture)
self._app.quit()
+
class QPictureTest(UsesQApplication):
def testFromData(self):
picture = QPicture()
painter = QPainter()
painter.begin(picture)
- painter.drawEllipse(10,20, 80,70)
+ painter.drawEllipse(10, 20, 80, 70)
painter.end()
data = picture.data()
@@ -67,6 +69,7 @@ class QPictureTest(UsesQApplication):
QTimer.singleShot(300, w.show)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py b/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
index 10d873abe..81afc3792 100644
--- a/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
+++ b/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
@@ -274,6 +274,7 @@ xpm = [
". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + "
]
+
class QStringSequenceTest(UsesQApplication):
def testQPixmapConstructor(self):
label = QLabel()
@@ -282,5 +283,6 @@ class QStringSequenceTest(UsesQApplication):
self.assertEqual(pixmap1.width(), 27)
self.assertEqual(pixmap1.height(), 22)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
index f126f58b6..78cfe75da 100644
--- a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QPushButton, QMenu, QWidget
from PySide6.QtCore import QTimer
+
class MyWidget(QWidget):
def __init__(self):
super().__init__()
@@ -71,6 +72,7 @@ class QPushButtonTest(UsesQApplication):
b.toggle()
self.assertTrue(self._clicked)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qshortcut_test.py b/sources/pyside6/tests/QtWidgets/qshortcut_test.py
index 4fefcca64..392f9dff6 100644
--- a/sources/pyside6/tests/QtWidgets/qshortcut_test.py
+++ b/sources/pyside6/tests/QtWidgets/qshortcut_test.py
@@ -43,6 +43,7 @@ from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QKeySequence, QShortcut
from PySide6.QtWidgets import QApplication, QWidget
+
class Foo(QWidget):
def __init__(self):
super().__init__()
@@ -55,6 +56,7 @@ class Foo(QWidget):
def slot_of_copy(self):
self.copy = True
+
class MyShortcut(QShortcut):
def __init__(self, keys, wdg, slot):
QShortcut.__init__(self, keys, wdg, slot)
@@ -62,6 +64,7 @@ class MyShortcut(QShortcut):
def emit_signal(self):
self.activated.emit()
+
class QAppPresence(unittest.TestCase):
def testQShortcut(self):
@@ -70,15 +73,16 @@ class QAppPresence(unittest.TestCase):
self.sc = MyShortcut(QKeySequence(Qt.Key_Return), f, f.slot_of_foo)
self.scstd = MyShortcut(QKeySequence.Copy, f, f.slot_of_copy)
- QTimer.singleShot(0, self.init);
+ QTimer.singleShot(0, self.init)
self.qapp.exec_()
self.assertEqual(f.ok, True)
self.assertEqual(f.copy, True)
def init(self):
- self.sc.emit_signal();
- self.scstd.emit_signal();
+ self.sc.emit_signal()
+ self.scstd.emit_signal()
self.qapp.quit()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qsplitter_test.py b/sources/pyside6/tests/QtWidgets/qsplitter_test.py
index 20d0209bb..cce68f2d7 100644
--- a/sources/pyside6/tests/QtWidgets/qsplitter_test.py
+++ b/sources/pyside6/tests/QtWidgets/qsplitter_test.py
@@ -39,6 +39,7 @@ from PySide6.QtWidgets import QSplitter
from helper.usesqapplication import UsesQApplication
+
class QSplitterTest(UsesQApplication):
def testGetRange(self):
@@ -47,6 +48,7 @@ class QSplitterTest(UsesQApplication):
self.assertTrue(isinstance(_min, int))
self.assertTrue(isinstance(_max, int))
+
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py b/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
index 2061f174d..ddc9d2245 100644
--- a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
@@ -44,14 +44,14 @@ from helper.usesqapplication import UsesQApplication
class QStandardItemModelTest(UsesQApplication):
def setUp(self):
- super(QStandardItemModelTest, self).setUp()
- self.window = QWidget()
- self.model = QStandardItemModel(0, 3, self.window)
+ super(QStandardItemModelTest, self).setUp()
+ self.window = QWidget()
+ self.model = QStandardItemModel(0, 3, self.window)
def tearDown(self):
- del self.window
- del self.model
- super(QStandardItemModelTest, self).tearDown()
+ del self.window
+ del self.model
+ super(QStandardItemModelTest, self).tearDown()
def testInsertRow(self):
# bug #227
@@ -92,7 +92,7 @@ class QStandardItemModelRef(UsesQApplication):
# only rest 1 reference
self.assertEqual(sys.getrefcount(items[r][c]), 2)
- my_i = model.item(0,0)
+ my_i = model.item(0, 0)
# ref(my_i) + parent_ref + items list ref
self.assertEqual(sys.getrefcount(my_i), 4)
diff --git a/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py b/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
index c8f6c2dbc..85ae7b65b 100644
--- a/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
@@ -63,6 +63,7 @@ class QStringQKeySequenceTest(UsesQApplication):
self.assertTrue(isinstance(shortcut, QKeySequence))
self.assertEqual(shortcut.toString(), keyseq)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qstyle_test.py b/sources/pyside6/tests/QtWidgets/qstyle_test.py
index 1b0208a62..6993e8b90 100644
--- a/sources/pyside6/tests/QtWidgets/qstyle_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstyle_test.py
@@ -42,6 +42,7 @@ from PySide6.QtGui import QWindow
from PySide6.QtWidgets import (QApplication, QFontComboBox, QLabel, QProxyStyle,
QStyleFactory, QWidget)
+
class ProxyStyle(QProxyStyle):
def __init__(self, style):
@@ -84,7 +85,7 @@ class SetStyleTest(UsesQApplication):
label.setStyle(proxyStyle)
label.show()
while not label.windowHandle().isExposed():
- QApplication.instance().processEvents()
+ QApplication.instance().processEvents()
self.assertTrue(proxyStyle.polished > 0)
def testSetStyleOwnership(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtableview_test.py b/sources/pyside6/tests/QtWidgets/qtableview_test.py
index a8b524527..8e457d781 100644
--- a/sources/pyside6/tests/QtWidgets/qtableview_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtableview_test.py
@@ -39,6 +39,7 @@ from PySide6.QtCore import QAbstractTableModel
from PySide6.QtWidgets import QTableWidget
from helper.usesqapplication import UsesQApplication
+
class QPenTest(UsesQApplication):
def testItemModel(self):
@@ -46,6 +47,7 @@ class QPenTest(UsesQApplication):
self.assertEqual(type(tv.model()), QAbstractTableModel)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
index a302dabfe..aeccf6118 100644
--- a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
@@ -43,6 +43,7 @@ def makeBug643(tab):
button = QPushButton('Foo')
tab.insertTab(0, button, 'Foo')
+
class RemoveTabMethod(TimedQApplication):
def setUp(self):
TimedQApplication.setUp(self)
@@ -52,7 +53,6 @@ class RemoveTabMethod(TimedQApplication):
del self.tab
TimedQApplication.tearDown(self)
-
def testRemoveTabPresence(self):
self.assertTrue(getattr(self.tab, 'removeTab'))
@@ -60,5 +60,6 @@ class RemoveTabMethod(TimedQApplication):
makeBug643(self.tab)
self.assertEqual(self.tab.count(), 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
index ff87f2bc2..cc3282361 100644
--- a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QMainWindow, QTabWidget, QTextEdit, QSplitter
from helper.usesqapplication import UsesQApplication
+
class TabWidgetClear(QMainWindow):
def __init__(self):
super().__init__()
@@ -55,6 +56,7 @@ class TabWidgetClear(QMainWindow):
self.tabWidget.clear()
self.getSplitter()
+
class TestTabWidgetClear(UsesQApplication):
def testClear(self):
@@ -66,5 +68,6 @@ class TestTabWidgetClear(UsesQApplication):
# This should never happened, PYSIDE-213
raise e
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
index 964e187f9..534527cac 100644
--- a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
@@ -69,6 +69,7 @@ class testSignalWithCPPSlot(UsesQApplication):
w.start()
self.assertEqual(w.text(), "PySide")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_test.py
index 241197f45..28f435f94 100644
--- a/sources/pyside6/tests/QtWidgets/qtextedit_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtextedit_test.py
@@ -42,6 +42,7 @@ from PySide6.QtWidgets import QTextEdit
from helper.usesqapplication import UsesQApplication
+
class DontTouchReference(UsesQApplication):
'''Check if the QTextTable returned by QTextCursor.insertTable() is not
referenced by the QTextCursor that returns it.'''
@@ -64,5 +65,6 @@ class DontTouchReference(UsesQApplication):
self.assertEqual(getrefcount(self.table), 2)
cell = self.table.cellAt(0, 0)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
index 3e5ae7194..3f86c3f98 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
@@ -42,29 +42,31 @@ from PySide6.QtWidgets import QToolBar, QMainWindow
from helper.usesqapplication import UsesQApplication
+
class AddActionText(UsesQApplication):
'''Test case for calling QToolbar.addAction passing a text'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(AddActionText, self).setUp()
self.window = QMainWindow()
self.toolbar = QToolBar()
self.window.addToolBar(self.toolbar)
def tearDown(self):
- #Release resources
+ # Release resources
super(AddActionText, self).tearDown()
del self.toolbar
del self.window
def testText(self):
- #QToolBar.addAction(text) - add a QToolButton
+ # QToolBar.addAction(text) - add a QToolButton
self.toolbar.addAction('aaaa')
self.assertEqual(len(self.toolbar.actions()), 1)
action = self.toolbar.actions()[0]
self.assertTrue(isinstance(action, QAction))
self.assertEqual(action.text(), 'aaaa')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
index e9b69821a..79c447fd7 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QToolBox, QWidget
from helper.usesqapplication import UsesQApplication
+
class OwnershipControl(UsesQApplication):
def setUp(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtreeview_test.py b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
index cbaed8c83..fbbbd6cef 100644
--- a/sources/pyside6/tests/QtWidgets/qtreeview_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
@@ -41,6 +41,7 @@ from PySide6.QtWidgets import (QWidget, QTreeView, QVBoxLayout,
from PySide6.QtCore import Qt
from helper.usesqapplication import UsesQApplication
+
class Widget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
@@ -52,6 +53,7 @@ class Widget(QWidget):
self.treeView.model().setHorizontalHeaderLabels(('3', '1', '5'))
+
class QWidgetTest(UsesQApplication):
def testDelegates(self):
@@ -99,5 +101,6 @@ class QWidgetTest(UsesQApplication):
tree.setHeader(QHeaderView(Qt.Horizontal))
self.assertIsNotNone(tree.header())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
index dbbad1c6d..2ed85b5c5 100644
--- a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QTreeWidget, QTreeWidgetItem, QPushButton
from helper.usesqapplication import UsesQApplication
+
class QTreeWidgetTest(UsesQApplication):
# PYSIDE-73:
@@ -58,14 +59,15 @@ class QTreeWidgetTest(UsesQApplication):
QPushButton('Push button on column 1'))
# Getting the widget back
- w = treeWidget.itemWidget(treeWidget.itemAt(0,1), 1)
+ w = treeWidget.itemWidget(treeWidget.itemAt(0, 1), 1)
self.assertIsInstance(w, QPushButton)
p = QPushButton('New independent button')
# Adding QPushButton object from variable
treeWidget.setItemWidget(item, 0, p)
- w = treeWidget.itemWidget(treeWidget.itemAt(0,0), 0)
+ w = treeWidget.itemWidget(treeWidget.itemAt(0, 0), 0)
self.assertIsInstance(w, QPushButton)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qvariant_test.py b/sources/pyside6/tests/QtWidgets/qvariant_test.py
index 49091502f..2907fb966 100644
--- a/sources/pyside6/tests/QtWidgets/qvariant_test.py
+++ b/sources/pyside6/tests/QtWidgets/qvariant_test.py
@@ -40,12 +40,15 @@ from PySide6.QtWidgets import (QApplication, QComboBox, QGraphicsScene,
from helper.usesqapplication import UsesQApplication
+
class MyDiagram(QGraphicsScene):
pass
+
class MyItem(QGraphicsRectItem):
def itemChange(self, change, value):
- return value;
+ return value
+
class Sequence(object):
# Having the __getitem__ method on a class transform the Python
@@ -57,6 +60,7 @@ class Sequence(object):
def __getitem__(self, key):
raise IndexError()
+
class QGraphicsSceneOnQVariantTest(UsesQApplication):
"""Test storage ot QGraphicsScene into QVariants"""
def setUp(self):
@@ -80,5 +84,6 @@ class QGraphicsSceneOnQVariantTest(UsesQApplication):
self.combo.addItem("test", userData=Sequence())
self.assertTrue(isinstance(self.combo.itemData(0), Sequence))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
index 807965e20..02ab052ee 100644
--- a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication, QHBoxLayout
from helper.usesqapplication import UsesQApplication
+
class QWidgetTest(UsesQApplication):
def test_setLayout(self):
@@ -63,6 +64,7 @@ class QWidgetTest(UsesQApplication):
widget = QWidget()
widget.setLayout(layout)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qwidget_test.py b/sources/pyside6/tests/QtWidgets/qwidget_test.py
index 5b8bdd5a0..4a90648f6 100644
--- a/sources/pyside6/tests/QtWidgets/qwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qwidget_test.py
@@ -39,10 +39,12 @@ init_test_paths(False)
from PySide6.QtWidgets import QWidget, QMainWindow
from helper.usesqapplication import UsesQApplication
+
class QWidgetInherit(QMainWindow):
def __init__(self):
QWidget.__init__(self) # Intended: Initialize QWidget instead of base
+
class NativeEventTestWidget(QWidget):
nativeEventCount = 0
@@ -54,11 +56,13 @@ class NativeEventTestWidget(QWidget):
self.nativeEventCount = self.nativeEventCount + 1
return [False, 0]
+
class QWidgetTest(UsesQApplication):
def testInheritance(self):
self.assertRaises(TypeError, QWidgetInherit)
+
class QWidgetVisible(UsesQApplication):
def testBasic(self):
@@ -77,5 +81,6 @@ class QWidgetVisible(UsesQApplication):
self.app.processEvents()
self.assertTrue(widget.nativeEventCount > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/reference_count_test.py b/sources/pyside6/tests/QtWidgets/reference_count_test.py
index 8ca382561..00ebab4c3 100644
--- a/sources/pyside6/tests/QtWidgets/reference_count_test.py
+++ b/sources/pyside6/tests/QtWidgets/reference_count_test.py
@@ -48,14 +48,17 @@ from helper.usesqapplication import UsesQApplication
destroyedRect = False
destroyedPol = False
+
def rect_del(o):
global destroyedRect
destroyedRect = True
+
def pol_del(o):
global destroyedPol
destroyedPol = True
+
class ReferenceCount(UsesQApplication):
def setUp(self):
@@ -71,7 +74,7 @@ class ReferenceCount(UsesQApplication):
self.assertTrue(isinstance(pol, QGraphicsPolygonItem))
self.wrp = weakref.ref(pol, pol_del)
- #refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
+ # refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
self.assertEqual(sys.getrefcount(pol), 3)
def testReferenceCount(self):
@@ -85,19 +88,20 @@ class ReferenceCount(UsesQApplication):
self.wrr = weakref.ref(rect, rect_del)
- #refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
+ # refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
self.assertEqual(sys.getrefcount(rect), 3)
del rect
- #not destroyed because one ref continue in QGraphicsScene
+ # not destroyed because one ref continue in QGraphicsScene
self.assertEqual(destroyedRect, False)
self.assertEqual(destroyedPol, False)
del self.scene
- #QGraphicsScene was destroyed and this destroy internal ref to rect
+ # QGraphicsScene was destroyed and this destroy internal ref to rect
self.assertEqual(destroyedRect, True)
self.assertEqual(destroyedPol, True)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/signature_test.py b/sources/pyside6/tests/QtWidgets/signature_test.py
index c18048b8e..94224c6ae 100644
--- a/sources/pyside6/tests/QtWidgets/signature_test.py
+++ b/sources/pyside6/tests/QtWidgets/signature_test.py
@@ -89,5 +89,6 @@ class PySideSignatureTest(unittest.TestCase):
called_default = sig.parameters["exclude"].default()
self.assertEqual(type(called_default), PySide6.QtCore.QByteArray)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
index 900d5fb75..c6e696807 100644
--- a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
+++ b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
@@ -40,11 +40,13 @@ from PySide6.QtWidgets import QStyle
from helper.usesqapplication import UsesQApplication
+
class StandardPixmapTest(UsesQApplication):
- def testDefaultOptions(self): # Bug 253
+ def testDefaultOptions(self): # Bug 253
pixmap = self.app.style().standardPixmap(QStyle.SP_DirClosedIcon)
self.assertTrue(isinstance(pixmap, QPixmap))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/test_module_template.py b/sources/pyside6/tests/QtWidgets/test_module_template.py
index 0f080fe99..83c1fce4b 100644
--- a/sources/pyside6/tests/QtWidgets/test_module_template.py
+++ b/sources/pyside6/tests/QtWidgets/test_module_template.py
@@ -38,12 +38,15 @@ init_test_paths()
from PySide6.QtWidgets import QWidget
from PySide6.QtCore import QObject
+
class MyQObject(QObject):
pass
+
class MyQWidget(QWidget):
pass
+
class Sentinel():
value = 10
diff --git a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
index 5fd685f01..afe09f0c1 100644
--- a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
+++ b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
@@ -42,11 +42,12 @@ from PySide6.QtWidgets import QApplication, QSpinBox
from helper.usesqapplication import UsesQApplication
+
class MySpinButton(QSpinBox):
'''Simple example class of overriding QObject.timerEvent'''
def __init__(self, max_runs=5, app=None):
- #Creates a new spinbox that will run <max_runs> and quit <app>
+ # Creates a new spinbox that will run <max_runs> and quit <app>
super().__init__()
if app is None:
@@ -57,7 +58,7 @@ class MySpinButton(QSpinBox):
self.runs = 0
def timerEvent(self, event):
- #Timer event method
+ # Timer event method
self.runs += 1
self.setValue(self.runs)
@@ -68,23 +69,24 @@ class MySpinButton(QSpinBox):
if not isinstance(event, QTimerEvent):
raise TypeError('Invalid event type. Must be TimerEvent')
+
class TimerEventTest(UsesQApplication):
'''Test case for running QObject.timerEvent from inherited class'''
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(TimerEventTest, self).setUp()
self.widget = MySpinButton(app=self.app)
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget
super(TimerEventTest, self).tearDown()
def testMethod(self):
- #QWidget.timerEvent overrinding (protected inherited)
+ # QWidget.timerEvent overrinding (protected inherited)
timer_id = self.widget.startTimer(0)
self.app.exec_()
diff --git a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
index f6c29425b..8629af5b7 100644
--- a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
+++ b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
@@ -44,6 +44,7 @@ from helper.usesqapplication import UsesQApplication
qgraphics_item_painted = False
+
class RoundRectItem(QGraphicsRectItem):
def __init__(self, x, y, w, h):
diff --git a/sources/pyside6/tests/QtWidgets/wrong_return_test.py b/sources/pyside6/tests/QtWidgets/wrong_return_test.py
index 134acef14..f9267f3fa 100644
--- a/sources/pyside6/tests/QtWidgets/wrong_return_test.py
+++ b/sources/pyside6/tests/QtWidgets/wrong_return_test.py
@@ -52,6 +52,7 @@ class MyWidget(QWidget):
def sizeHint(self):
pass
+
class testCase(UsesQApplication):
def testVirtualReturn(self):