def testSum(self): fiveDollars = makeDollar(5) tenFrancs = makeFranc(10) sum = tenFrancs + fiveDollars expected = makeDollar(20) actual = self.bank.reduce(sum.times(2), 'USD') self.assertEqual(actual, expected)
def testReduceMoneyWithDifferentCurrencies(self): result = self.cut(makeFranc(2), 'USD') self.assertEqual(result, makeDollar(1))
def testReduceMoney(self): self.assertEqual(self.cut(makeDollar(7), 'USD'), makeDollar(7))
def testReduceSum(self): sum = makeDollar(3) + makeDollar(4) self.assertEqual(self.cut(sum, 'USD'), makeDollar(7))
def testSumPlusMoney(self): five = makeDollar(5) sum = five + five sum += makeFranc(10) self.assertEqual(self.bank.reduce(sum, 'USD'), makeDollar(15))
def testPlusReturnsASum(self): five = makeDollar(5) sum = five + five self.assertEqual(sum._augend, five) self.assertEqual(sum._addend, five)
def testDifferentCurrencies(self): sum = makeDollar(5) + makeFranc(10) reduced = self.bank.reduce(sum, 'USD') self.assertEqual(reduced, makeDollar(10))
def testSameCurrency(self): sum = makeDollar(5) + makeDollar(5) reduced = self.bank.reduce(sum, 'USD') self.assertEqual(reduced, makeDollar(10))
def testDollar(self): self.assertEqual(makeDollar(1).getCurrency(), 'USD')
def testNotEquals(self): self.assertNotEqual(makeDollar(5), makeDollar(6)) self.assertNotEqual(makeFranc(5), makeDollar(5))
def testEquals(self): self.assertEqual(makeDollar(5), makeDollar(5))
def testSimple(self): five = makeDollar(5) self.assertEqual(makeDollar(10), five.times(2)) self.assertEqual(makeDollar(15), five.times(3))