def test_dollar(): assert Dollar(7).amount == Dollar(5).plus(2) assert Dollar(8).amount == Dollar(5).plus(3)
def test_dollar_to_franc(): assert Money(20).amount == Bank().source_to_destiny(Dollar(10), 'CHF') assert Money(137.33).amount == Bank().source_to_destiny(Dollar(68.665), 'CHF') assert Money(68.665).amount == Bank().source_to_destiny(Dollar(68.665), 'USD')
def test_exchange_rate(): assert Money(5).amount == Bank().exchange_rate(Franc(10)) assert Money(68.665).amount == Bank().exchange_rate(Franc(137.33)) assert Money(10).amount == Bank().exchange_rate(Dollar(10))
def test_dollar(self): self.assertEqual(Dollar(10).amount, Dollar(5).times(2)) self.assertEqual(Dollar(15).amount, Dollar(5).times(3))
def test_dollar(self): assert Dollar(10).equals_currency(Dollar(10)) assert Dollar(10).equals_currency(Dollar(15))
def test_inter(self): self.assertFalse(Dollar(10).equals_currency(Franc(10))) self.assertFalse(Dollar(10).equals_currency(Franc(15))) self.assertFalse(Money(10).equals_currency(Franc(10))) self.assertFalse(Money(10).equals_currency(Franc(15)))
def test_dollar(self): assert Dollar(4).equals(Dollar(4)) assert Dollar(5).equals(Dollar(5)) self.assertFalse(Dollar(5).equals(Dollar(4))) self.assertFalse(Dollar(5).equals(Dollar(6)))
def test_inter(self): self.assertFalse(Dollar(5).equals(Franc(5))) self.assertFalse(Dollar(5).equals(Franc(6)))