Created unit test to test shiboken objects destructor.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
505ba23a9d
commit
4f51600e20
2 changed files with 20 additions and 0 deletions
19
tests/QtCore/qobject_destructor.py
Normal file
19
tests/QtCore/qobject_destructor.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import sys
|
||||
import unittest
|
||||
from PySide import QtCore
|
||||
|
||||
class MyObject(QtCore.QObject):
|
||||
def __init__(self, other=None):
|
||||
QtCore.QObject.__init__(self, None)
|
||||
self._o = other
|
||||
|
||||
class TestDestructor(unittest.TestCase):
|
||||
def testReference(self):
|
||||
o = QtCore.QObject()
|
||||
m = MyObject(o)
|
||||
self.assertEqual(sys.getrefcount(o), 3)
|
||||
del m
|
||||
self.assertEqual(sys.getrefcount(o), 2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue