def testUsersPrimitiveFromRequiredModuleAsReturnValue(self): '''Complex Number::toComplex()''' number = Number(12) cpx = number.toComplex() self.assertEqual(number.value(), int(cpx.real))
def testUsersPrimitiveFromRequiredModuleAsReturnValue(self): """Complex Number::toComplex()""" number = Number(12) cpx = number.toComplex() self.assertEqual(number.value(), int(cpx.real))
def testUsersPrimitiveFromRequiredModuleAsArgument(self): '''static Number Number::fromComplex(Complex)''' cpx = complex(3.0, 1.2) number = Number.fromComplex(cpx) self.assertEqual(number.value(), int(cpx.real))
def __init__(self): Derived.__init__(self, 42) Number.__init__(self, 42)
def testUsersPrimitiveFromRequiredModuleAsArgument(self): """static Number Number::fromComplex(Complex)""" cpx = complex(3.0, 1.2) number = Number.fromComplex(cpx) self.assertEqual(number.value(), int(cpx.real))
def testStrCtorWithNumberArgument(self): '''Try to build a Str from 'sample' module with a Number argument from 'other' module.''' value = 123 num = Number(value) string = Str(num)
def testNumber(self): '''Basic test to see if the Number class is Ok.''' value = 123 num = Number(value) self.assertEqual(num.value(), value)
def testPointTimesNumber(self): '''sample.Point * other.Number''' pt = Point(2, 7) num = Number(11) self.assertEqual(pt * num, pt * 11)