diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-12-16 14:08:29 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:12:49 -0300 |
commit | 36c80e6daab7b8d69458c1a8154f4a17ee1ea303 (patch) | |
tree | ec11e8808640f67d27530f8f3ac18d62f1463751 /tests/samplebinding/keep_reference_test.py | |
parent | 18fedbce6893ee76c3dce04f0aaf814c93d57a34 (diff) |
Added tests to check the release of ownership of objects returned from Python.
The ObjectModel test class was introduced to check if the transference
of ownership of objects returned from Python to C++ through a virtual
method is working properly.
Also updated the other test that uses the ObjectView class.
Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/samplebinding/keep_reference_test.py')
-rw-r--r-- | tests/samplebinding/keep_reference_test.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/samplebinding/keep_reference_test.py b/tests/samplebinding/keep_reference_test.py index 13730553e..fd99a23ca 100644 --- a/tests/samplebinding/keep_reference_test.py +++ b/tests/samplebinding/keep_reference_test.py @@ -29,14 +29,14 @@ import unittest from sys import getrefcount -from sample import ObjectType, ObjectView +from sample import ObjectModel, ObjectView class TestKeepReference(unittest.TestCase): '''Test case for objects that keep references to other object without owning them (e.g. model/view relationships).''' def testReferenceCounting(self): '''Tests reference count of model-like object referred by view-like objects.''' - model1 = ObjectType() + model1 = ObjectModel() refcount1 = getrefcount(model1) view1 = ObjectView() view1.setModel(model1) @@ -46,13 +46,13 @@ class TestKeepReference(unittest.TestCase): view2.setModel(model1) self.assertEqual(getrefcount(view2.model()), refcount1 + 2) - model2 = ObjectType() + model2 = ObjectModel() view2.setModel(model2) self.assertEqual(getrefcount(view1.model()), refcount1 + 1) def testReferenceCountingWhenDeletingReferrer(self): '''Tests reference count of model-like object referred by deceased view-like object.''' - model = ObjectType() + model = ObjectModel() refcount1 = getrefcount(model) view = ObjectView() view.setModel(model) @@ -64,7 +64,7 @@ class TestKeepReference(unittest.TestCase): def testReferreedObjectSurvivalAfterContextEnd(self): '''Model-like object assigned to a view-like object must survive after get out of context.''' def createModelAndSetToView(view): - model = ObjectType() + model = ObjectModel() model.setObjectName('created model') view.setModel(model) view = ObjectView() |