From 5944cc8d99d0c72cd87aa572224d3492e05c10eb Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 29 Oct 2010 10:57:35 -0300 Subject: Added test for bug #428. Reviewed by Lauro Moura Reviewed by Luciano Wolf --- tests/QtCore/qobject_inherits_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/QtCore') diff --git a/tests/QtCore/qobject_inherits_test.py b/tests/QtCore/qobject_inherits_test.py index 9e02b0a46..fce383aae 100644 --- a/tests/QtCore/qobject_inherits_test.py +++ b/tests/QtCore/qobject_inherits_test.py @@ -38,6 +38,19 @@ class InheritsCase(unittest.TestCase): self.assert_(Dummy().inherits('QObject')) self.assert_(not Dummy().inherits('Parent')) + def testSetAttributeBeforeCallingInitOnQObjectDerived(self): + '''Test for bug #428.''' + class DerivedObject(QObject): + def __init__(self): + self.member = 'member' + QObject.__init__(self) + obj0 = DerivedObject() + # The second instantiation of DerivedObject will generate an exception + # that will not come to surface immediately. + obj1 = DerivedObject() + # The mere calling of the object method causes + # the exception to "reach the surface". + obj1.objectName() if __name__ == '__main__': unittest.main() -- cgit v1.2.3