def test_empty_from(self): ''' ther is no info about from_currency in the rates :return: ''' converse = ConvertRate(from_currency=US_DOLLAR, to_currency=CZECH_KRONA, amount=1000) del self.rates[US_DOLLAR] with self.assertRaises(AttributeError): converse.find_rate(self.rates)
def test_empty_to(self): ''' in the rates does not info about rate for to_currency :return: ''' converse = ConvertRate(from_currency=US_DOLLAR, to_currency=CZECH_KRONA, amount=1000) del self.rates[US_DOLLAR][CZECH_KRONA] finded_rate = converse.find_rate(self.rates) self.assertIsNone(finded_rate)
def test_pln_eur(self): converse = ConvertRate(from_currency=POLISH_ZLOTY, to_currency=EURO, amount=1000) finded_rate = converse.find_rate(self.rates) self.assertEqual(0.2324662343, finded_rate)
def test_empty(self): converse = ConvertRate(from_currency=POLISH_ZLOTY, to_currency=EURO, amount=1000) with self.assertRaises(AttributeError): converse.find_rate({})
def test_usd_czk(self): converse = ConvertRate(from_currency=US_DOLLAR, to_currency=CZECH_KRONA, amount=1000) finded_rate = converse.find_rate(self.rates) self.assertEqual(22.5518744551, finded_rate)