示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 def test_empty(self):
     converse = ConvertRate(from_currency=POLISH_ZLOTY, to_currency=EURO, amount=1000)
     with self.assertRaises(AttributeError):
         converse.find_rate({})
示例#5
0
 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)