def testCastFromMDerived1ToBases(self):
     '''MDerived1 is casted by C++ to its parents and the binding must return the MDerived1 wrapper.'''
     a = MDerived1()
     refcnt = sys.getrefcount(a)
     b1 = a.castToBase1()
     b2 = a.castToBase2()
     self.assert_(isinstance(b1, MDerived1))
     self.assert_(isinstance(b2, MDerived1))
     self.assertEqual(a, b1)
     self.assertEqual(a, b2)
     self.assertEqual(sys.getrefcount(a), refcnt + 2)
 def testCallToFunctionWithBase2ArgumentThatCastsBackToMDerived1(self):
     '''MDerived1 is passed as an Base2 argument to a method that returns it casted back to MDerived1.'''
     a = MDerived1()
     b = MDerived1.transformFromBase2(a)
     self.assertEqual(a, b)
 def testIsInstance(self):
     '''MDerived1 is instance of its parents Base1 and Base2.'''
     a = MDerived1()
     self.assert_(isinstance(a, MDerived1))
     self.assert_(isinstance(a, Base1))
     self.assert_(isinstance(a, Base2))
 def __init__(self):
     MDerived1.__init__(self)
     self.multiplier = 20
     self.base2Method_called = False
 def testCallToFunctionWithBase2ArgumentThatCastsBackToMDerived1(self):
     '''MDerived1 is passed as an Base2 argument to a method that returns it casted back to MDerived1.'''
     a = MDerived1()
     b = MDerived1.transformFromBase2(a)
     self.assertEqual(a, b)
 def __init__(self):
     MDerived1.__init__(self)
     self.multiplier = 20
     self.base2Method_called = False