diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/samplebinding/duck_punching_test.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/samplebinding/duck_punching_test.py b/tests/samplebinding/duck_punching_test.py index cbf48c135..013e36468 100644 --- a/tests/samplebinding/duck_punching_test.py +++ b/tests/samplebinding/duck_punching_test.py @@ -68,6 +68,13 @@ class DuckPunchingTest(unittest.TestCase): self.assertEqual(result1, result2) self.assertEqual(result1, VirtualMethods.virtualMethod0(vm, pt, val, cpx, b) * self.multiplier) + # This is done to decrease the refcount of the vm object + # allowing the object wrapper to be deleted before the + # BindingManager. This is useful when compiling Shiboken + # for debug, since the BindingManager destructor has an + # assert that checks if the wrapper mapper is empty. + vm.virtualMethod0 = None + def testMonkeyPatchOnVirtualMethodWithInheritance(self): '''Injects new 'virtualMethod0' on an object that inherits from VirtualMethods and makes C++ call it.''' duck = Duck() @@ -90,6 +97,8 @@ class DuckPunchingTest(unittest.TestCase): self.assertEqual(result1, result2) self.assertEqual(result1, VirtualMethods.virtualMethod0(duck, pt, val, cpx, b) * self.multiplier) + duck.virtualMethod0 = None + def testMonkeyPatchOnMethodWithStaticAndNonStaticOverloads(self): '''Injects new 'exists' on a SimpleFile instance and makes C++ call it.''' simplefile = SimpleFile('foobar') @@ -112,6 +121,8 @@ class DuckPunchingTest(unittest.TestCase): simplefile.exists() self.assert_(self.duck_method_called) + simplefile.exists = None + def testMonkeyPatchOnMethodWithStaticAndNonStaticOverloadsWithInheritance(self): '''Injects new 'exists' on an object that inherits from SimpleFile and makes C++ call it.''' monkey = Monkey('foobar') @@ -134,6 +145,8 @@ class DuckPunchingTest(unittest.TestCase): monkey.exists() self.assert_(self.duck_method_called) + monkey.exists = None + if __name__ == '__main__': unittest.main() |