def test_mixed_addition(self): five_bucks = Money.dollar(5) ten_francs = Money.franc(10) bank = Bank() bank.add_rate("CHF", "USD", 2) result = bank.reduce(five_bucks.plus(ten_francs), "USD") self.assertEqual(Money.dollar(10), result)
def test_reduce_money_different_currency(): bank = Bank() bank.add_rate("CHF", "USD", 2) result = bank.exchange(Money.francs(2), "USD") assert Money.dollar(1) == result
def test_mixed_addition(self): five_bucks = Money.dollar(5) ten_francs = Money.franc(10) bank = Bank() bank.add_rate('CHF', 'USD', 2) result = bank.reduce(five_bucks.plus(ten_francs), 'USD') assert Money.dollar(10) == result
def test_sum_times(self): five_bucks = Money.dollar(5) ten_francs = Money.franc(10) bank = Bank() bank.add_rate("CHF", "USD", 2) _sum = Sum(five_bucks, ten_francs).times(2) result = bank.reduce(_sum, "USD") self.assertEqual(Money.dollar(20), result)
def test_sum_times(): five_bucks = Money.dollar(5) ten_franc = Money.franc(10) bank = Bank() bank.add_rate("CHF", "USD", 2) expression_sum = Sum(five_bucks, ten_franc).times(2) result = bank.reduce(expression_sum, "USD") assert result == Money.dollar(20)
def test_total_times(self): five_bucks = Money.dollar(5) ten_francs = Money.franc(10) bank = Bank() bank.add_rate('CHF', 'USD', 2) total = Total(five_bucks, ten_francs).times(2) result = bank.reduce(total, 'USD') assert Money.dollar(20) == result
def test_total_plus_money(self): five_bucks = Money.dollar(5) ten_francs = Money.franc(10) bank = Bank() bank.add_rate('CHF', 'USD', 2) total = Total(five_bucks, ten_francs).plus(five_bucks) result = bank.reduce(total, 'USD') assert Money.dollar(15) == result
def test_sum_times(): five_bucks = Money.dollar(5) ten_francs = Money.franc(10) bank = Bank() bank.add_rate("CHF", "USD", 2) sum = Sum(five_bucks, ten_francs).times(2) result = bank.reduce(sum, "USD") assert Money.dollar(20) == result
def test_sum_plus_money(): five_bucks = Money.dollar(5) ten_francs = Money.franc(10) bank = Bank() bank.add_rate("CHF", "USD", 2) sum = Sum(five_bucks, ten_francs).plus(five_bucks) result = bank.reduce(sum, "USD") assert Money.dollar(15) == result
def test_mixed_addition(): five_bucks = Money.dollar(5) ten_francs = Money.francs(10) bank = Bank() bank.add_rate("CHF", "USD", 2) result = five_bucks + bank.exchange(ten_francs, "USD") assert result == Money.dollar(10)
def test_reduce_money_different_currency(self): bank = Bank() bank.add_rate("CHF", "USD", 2) result = bank.reduce(Money.franc(2), "USD") self.assertEqual(Money.dollar(1), result)
def test_reduce_money_different_currency(self): bank = Bank() bank.add_rate('CHF', 'USD', 2) result = bank.reduce(Money.franc(2), 'USD') assert Money.dollar(1), result
def bank(): mybank = Bank() mybank.add_rate("CHF", "USD", 2) return mybank