示例#1
0
 def test_mixed_addition(self):
     five_bucks = Money.dollar(5)
     ten_franc = Money.franc(10)
     bank = Bank()
     bank.add_rate('CHF', 'USD', 2)
     result = bank.reduce(five_bucks.plus(ten_franc), 'USD')
     assert Money.dollar(10) == result
示例#2
0
 def test_mix_ed_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)
示例#3
0
 def test_sum_times(self):
     five_bucks = Money.dollar(5)
     ten_franc = Money.franc(10)
     bank = Bank()
     bank.add_rate('CHF', 'USD', 2)
     total = Total(five_bucks, ten_franc).times(2)
     result = bank.reduce(total, 'USD')
     assert Money.dollar(20) == result
示例#4
0
 def test_sum_plus_money(self):
     five_bucks = Money.dollar(5)
     ten_franc = Money.franc(10)
     bank = Bank()
     bank.add_rate('CHF', 'USD', 2)
     total = Total(five_bucks, ten_franc).plus(five_bucks)
     result = bank.reduce(total, 'USD')
     assert Money.dollar(15) == result
示例#5
0
 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)
示例#6
0
 def test_total_times(self):
     """moneyの倍"""
     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")
     self.assertEqual(Money.dollar(20), result)
示例#7
0
 def test_totalplus_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")
     self.assertEqual(Money.dollar(15), result)
示例#8
0
 def test_reducemoney_diff_currency(self):
     """別の貨幣へ変換"""
     bank = Bank()
     bank.add_rate("CHF", "USD", 2)
     result = bank.reduce(Money.franc(2), "USD")
     self.assertEqual(Money.dollar(1), result)
示例#9
0
 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