aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/tests/pysidetest/multiple_inheritance_test.py')
-rw-r--r--sources/pyside6/tests/pysidetest/multiple_inheritance_test.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py b/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py
index 033a065ab..fe8e14f9f 100644
--- a/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py
+++ b/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py
@@ -19,6 +19,7 @@ def xprint(*args, **kw):
if "-v" in sys.argv:
print(*args, **kw)
+
# This is the original testcase of PYSIDE-1564
class Age(object):
def __init__(self, age=0, **kwds):
@@ -26,6 +27,7 @@ class Age(object):
self.age = age
+
class Person(QtCore.QObject, Age):
def __init__(self, name, **kwds):
super().__init__(**kwds)
@@ -43,6 +45,7 @@ class OriginalMultipleInheritanceTest(unittest.TestCase):
# More tests follow:
+
# mro ('C', 'A', 'QObject', 'Object', 'B', 'object')
class A(QtCore.QObject):
def __init__(self, anna=77, **kw):
@@ -50,6 +53,7 @@ class A(QtCore.QObject):
super().__init__(**kw)
xprint('A: after init')
+
class B:
def __init__(self, otto=6, age=7, **kw):
xprint(f'B: before init kw = {kw}')
@@ -59,12 +63,14 @@ class B:
self.age = age
xprint('B: after init')
+
class C(A, B):
def __init__(self, **kw):
xprint(f'C: before init kw = {kw}')
super().__init__(**kw)
xprint('C: after init')
+
# mro ('F', 'D', 'QCursor', 'E', 'QLabel', 'QFrame', 'QWidget', 'QObject', 'QPaintDevice', 'Object', 'object')
class D(QtGui.QCursor):
def __init__(self, anna=77, **kw):
@@ -72,6 +78,7 @@ class D(QtGui.QCursor):
super().__init__(**kw)
xprint('D: after init')
+
class E:
def __init__(self, age=7, **kw):
xprint(f'E: before init kw = {kw}')
@@ -79,17 +86,20 @@ class E:
self.age = age
xprint('E: after init')
+
class F(D, E, QtWidgets.QLabel):
def __init__(self, **kw):
xprint(f'F: before init kw = {kw}')
super().__init__(**kw)
xprint('F: after init')
+
# mro ('I', 'G', 'QTextDocument', 'H', 'QLabel', 'QFrame', 'QWidget', 'QObject', 'QPaintDevice', 'Object', 'object')
# Similar, but this time we want to reach `H` without support from `super`.
class G(QtGui.QTextDocument):
pass
+
class H:
def __init__(self, age=7, **kw):
xprint(f'H: before init kw = {kw}')
@@ -97,6 +107,7 @@ class H:
self.age = age
xprint('H: after init')
+
class I(G, H, QtWidgets.QLabel):
pass
@@ -108,6 +119,7 @@ class Ui_X_MainWindow(object): # Emulating uic
MainWindow.resize(400, 300)
self.lbl = QLabel(self)
+
class MainWindow(QMainWindow, Ui_X_MainWindow):
def __init__(self, parent=None):
super().__init__(parent)
@@ -122,7 +134,7 @@ class AdditionalMultipleInheritanceTest(UsesQApplication):
self.assertEqual(res.age, 7)
xprint()
with self.assertRaises(AssertionError):
- res=C(killme=42)
+ res = C(killme=42)
xprint()
def testDEF(self):