def test_mult_de_somme(): banque = monnaie.Banque() expression = (monnaie.franc(2) + monnaie.dollar(1)) * 4 assert monnaie.franc(10) == banque.conversion(expression, "CHF")
def test_somme_conversion_deux_monnaies(): assert monnaie.franc(2) == monnaie.Banque().conversion( monnaie.dollar(2) + monnaie.franc(1), "CHF")
def test_somme_de_somme_2(): banque = monnaie.Banque() expression = (monnaie.dollar(1) + monnaie.franc(2)) + monnaie.dollar(1) assert monnaie.franc(3) == banque.conversion(expression, "CHF")
def test_banque_change_CHF_dollar(): assert 2 == monnaie.Banque().change("CHF", "USD") assert 0.5 == approx(monnaie.Banque().change("USD", "CHF"))
def test_banque_change_identique(): assert 1 == monnaie.Banque().change("USD", "USD")
def test_banque_conversion_monnaie_differente(): banque = monnaie.Banque() assert monnaie.franc(1) == banque.conversion(monnaie.dollar(2), "CHF")
def test_banque_conversion_monnaie_identique(): banque = monnaie.Banque() assert monnaie.dollar(1) == banque.conversion(monnaie.dollar(1), "USD")
def test_conversion_addition(): somme = monnaie.dollar(5) + monnaie.dollar(2) banque = monnaie.Banque() conversion = banque.conversion(somme, "USD") assert monnaie.dollar(7) == conversion