Skip to content

Commit

Permalink
add decimal argument when force_decimal used
Browse files Browse the repository at this point in the history
  • Loading branch information
ravigadila committed Feb 12, 2017
1 parent e811bd4 commit b432b3b
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions tests/test_bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ def test_convert_to_btc_on_with_valid_currency(self):

def test_convert_to_btc_on_with_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# coins = convert_to_btc_on(300, 'XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, convert_to_btc_on, 300, 'XYZ', date_obj)
# self.assertFalse(coins)


class TestConvertBtcToCurOn(TestCase):
Expand All @@ -104,9 +102,7 @@ def test_convert_to_btc_on_with_valid_currency(self):

def test_convert_to_btc_on_with_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# amount = convert_btc_to_cur_on(3, 'XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, convert_btc_to_cur_on, 3, 'XYZ', date_obj)
# self.assertFalse(amount)


class TestBitCoinSymbol(TestCase):
Expand Down Expand Up @@ -137,9 +133,7 @@ def test_previous_price_valid_currency(self):

def test_previous_price_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# price = self.b.get_previous_price('XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, self.b.get_previous_price, 'XYZ', date_obj)
# self.assertFalse(price)

def test_previous_price_list_with_valid_currency(self):
start_date = datetime.datetime.today() - datetime.timedelta(days=15)
Expand All @@ -160,9 +154,7 @@ def test_convet_to_btc_with_valid_currency(self):
self.assertEqual(type(coins), float)

def test_convet_to_btc_with_invalid_currency(self):
# coins = self.b.convert_to_btc(250, 'XYZ')
self.assertRaises(RatesNotAvailableError, self.b.convert_to_btc, 250, 'XYZ')
# self.assertFalse(coins)

def test_convert_btc_to_cur_valid_currency(self):
amount = self.b.convert_btc_to_cur(2, 'USD')
Expand All @@ -178,9 +170,7 @@ def test_convert_to_btc_on_with_valid_currency(self):

def test_convert_to_btc_on_with_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# coins = self.b.convert_to_btc_on(300, 'XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, self.b.convert_to_btc_on, 300, 'XYZ', date_obj)
# self.assertFalse(coins)

def test_convert_to_btc_on_with_valid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
Expand All @@ -189,9 +179,7 @@ def test_convert_to_btc_on_with_valid_currency(self):

def test_convert_to_btc_on_with_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# amount = self.b.convert_btc_to_cur_on(3, 'XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, self.b.convert_btc_to_cur_on, 3, 'XYZ', date_obj)
# self.assertFalse(amount)


class TestBitCoinForceDecimal(TestCase):
Expand All @@ -214,9 +202,7 @@ def test_previous_price_valid_currency(self):

def test_previous_price_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# price = self.b.get_previous_price('XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, self.b.get_previous_price, 'XYZ', date_obj)
# self.assertFalse(price)

def test_previous_price_list_with_valid_currency(self):
start_date = datetime.datetime.today() - datetime.timedelta(days=15)
Expand All @@ -233,39 +219,34 @@ def test_previous_price_list_with_invalid_currency(self):
self.assertEqual(type(price_list), dict)

def test_convet_to_btc_with_valid_currency(self):
coins = self.b.convert_to_btc(250, 'USD')
coins = self.b.convert_to_btc(Decimal('250'), 'USD')
self.assertEqual(type(coins), Decimal)

def test_convet_to_btc_with_invalid_currency(self):
# coins = self.b.convert_to_btc(250, 'XYZ')
self.assertRaises(RatesNotAvailableError, self.b.convert_to_btc, Decimal('250'), 'XYZ')
# self.assertFalse(coins)

def test_convert_btc_to_cur_valid_currency(self):
amount = self.b.convert_btc_to_cur(2, 'USD')
amount = self.b.convert_btc_to_cur(Decimal('2'), 'USD')
self.assertEqual(type(amount), Decimal)

def test_convert_btc_to_cur_invalid_currency(self):
self.assertRaises(RatesNotAvailableError, self.b.convert_btc_to_cur, 2, 'XYZ')
self.assertRaises(RatesNotAvailableError, self.b.convert_btc_to_cur, Decimal('250'), 'XYZ')

def test_convert_to_btc_on_with_valid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
coins = self.b.convert_to_btc_on(300, 'USD', date_obj)
coins = self.b.convert_to_btc_on(Decimal('300'), 'USD', date_obj)
self.assertEqual(type(coins), Decimal)

def test_convert_to_btc_on_with_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# coins = self.b.convert_to_btc_on(300, 'XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, self.b.convert_to_btc_on, Decimal('250'), 'XYZ', date_obj)
# self.assertFalse(coins)

def test_convert_to_btc_on_with_valid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
amount = self.b.convert_btc_to_cur_on(3, 'USD', date_obj)
amount = self.b.convert_btc_to_cur_on(Decimal('250'), 'USD', date_obj)
self.assertEqual(type(amount), Decimal)

def test_convert_to_btc_on_with_invalid_currency(self):
date_obj = datetime.datetime.today() - datetime.timedelta(days=15)
# amount = self.b.convert_btc_to_cur_on(3, 'XYZ', date_obj)
self.assertRaises(RatesNotAvailableError, self.b.convert_btc_to_cur_on, Decimal('3'), 'XYZ', date_obj)
# self.assertFalse(amount)

0 comments on commit b432b3b

Please sign in to comment.