def test_CppClone(self): # test what happens when Clone is called from C++ if hasattr(wx, 'testCppClone'): evt1 = wx.PyEvent() evt1.attr = 'testCppClone' evt2 = wx.testCppClone(evt1) self.assertTrue(evt1.attr == evt2.attr)
def test_CppCloneDerived(self): # test what happens when Clone is called from C++ if hasattr(wx, 'testCppClone'): evt1 = MyPyEvent() evt1.attr = 'testCppClone' evt2 = wx.testCppClone(evt1) self.assertTrue(evt1.attr == evt2.attr) self.assertTrue(isinstance(evt2, MyPyEvent))
def test_CppCloneRefCounts(self): # Since we're doing some funky stuff under the covers with Clone, make # sure that the reference counts on everything (before and after) # still make sense if hasattr(wx, 'testCppClone'): evt1 = wx.PyEvent() rc1 = sys.getrefcount(evt1) evt1.attr = 'Howdy!' evt2 = wx.testCppClone(evt1) rc2 = sys.getrefcount(evt2) rc3 = sys.getrefcount(evt1) self.assertTrue(rc1 == rc2 == rc3) self.assertTrue(evt1.attr == evt2.attr)