def RetornarCambio(moedaDestino, Valor): if moedaDestino == 1: return BRL.RealParaDollar(Valor) elif moedaDestino == 2: return Valor elif moedaDestino == 3: return BRL.RealParaPeso(Valor) elif moedaDestino == 4: return BRL.RealParaEuro(Valor) elif moedaDestino == 5: return BRL.RealParaLibra(Valor) elif moedaDestino == 6: return BRL.RealParaBitcoin(Valor)
def PesoParaLibra(pValor): return (pValor / (GBP.LibraParaReal(1) * BRL.RealParaPeso(1)))
def PesoParaEuro(pValor): return (pValor / ( (EUR.EuroParaDollar(1) * USD.DollarParaReal(1)) * BRL.RealParaPeso(1)))
def PesoParaDollar(pValor): return pValor / (USD.DollarParaReal(1) * BRL.RealParaPeso(1))
def test_RealParaBitcoin(self): result = round(BRL.RealParaBitcoin(60455)) expected = 1 self.assertEqual(result, expected)
def test_RealParaLibra(self): result = round(BRL.RealParaLibra(60.00), 2) expected = 8.29 self.assertEqual(result, expected)
def test_RealParaEuro(self): result = round(BRL.RealParaEuro(5.00), 2) expected = 0.75 self.assertEqual(result, expected)
def test_RealParaPeso(self): result = round(BRL.RealParaPeso(10.00), 2) expected = 142.86 self.assertEqual(result, expected)
def test_RealParaDollar(self): result = round(BRL.RealParaDollar(50.30), 2) expected = 8.90 self.assertEqual(result, expected)
def DollarParaPeso(pValor): return pValor * (DollarParaReal(1) * BRL.RealParaPeso(1))
def LibraParaPeso(pValor): return pValor * (LibraParaReal(1) * BRL.RealParaPeso(1))
def EuroParaPeso(pValor): return pValor * (EuroParaDollar(1) * USD.DollarParaReal(1) * BRL.RealParaPeso(1))