def testImplicitConversions(self): """Test if overloaded function call decisor takes implicit conversions into account.""" ic = ImplicitConv.implicitConvCommon(ImplicitConv()) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorNone) ic = ImplicitConv.implicitConvCommon(3) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorOne) self.assertEqual(ic.objId(), 3) ic = ImplicitConv.implicitConvCommon(ImplicitConv.CtorThree) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorThree) obj = ObjectType() ic = ImplicitConv.implicitConvCommon(obj) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorObjectTypeReference) ic = ImplicitConv.implicitConvCommon(42.42) self.assertEqual(ic.value(), 42.42)
def testMethodWithAllParamers(self): '''Method with all parameters: Time.somethingCompletelyDifferent( int h, int m, ImplicitConv ic = ImplicitConv::CtorThree, ObjectType* type = 0 ); ''' time = Time() obj = ObjectType() result = time.somethingCompletelyDifferent(1, 2, ImplicitConv(2), obj) self.assertEqual(result, Time.FourArgs)
def testImplicitConversions(self): '''Test if overloaded function call decisor takes implicit conversions into account.''' ic = ImplicitConv.implicitConvCommon(ImplicitConv()) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorNone) ic = ImplicitConv.implicitConvCommon(3) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorOne) self.assertEqual(ic.objId(), 3) ic = ImplicitConv.implicitConvCommon(ImplicitConv.CtorThree) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorThree) obj = ObjectType() ic = ImplicitConv.implicitConvCommon(obj) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorObjectTypeReference) ic = ImplicitConv.implicitConvCommon(42.42) self.assertEqual(ic.value(), 42.42) ic = ImplicitConv(None) self.assertEqual(ic.ctorEnum(), ImplicitConv.CtorPrimitiveType)
def testMethodWithThreeParamers(self): '''Method with 3 parameters: Time.somethingCompletelyDifferent(...)''' time = Time() result = time.somethingCompletelyDifferent(1, 2, ImplicitConv(ImplicitConv.CtorOne)) self.assertEqual(result, Time.ThreeArgs)