Esempio n. 1
0
 def test_calculate_price_success(self):
     response = calculate("10", "USD")
     self.assertEqual(response, Decimal("15.00"))
Esempio n. 2
0
 def test_calculate_price_success_three_decimals(self):
     response = calculate(".5555", "USD", decimals=3)
     self.assertEqual(response, Decimal("0.834"))
Esempio n. 3
0
def show_currency(price, code, decimals=2):
    return calculate(price, code, decimals=decimals)
Esempio n. 4
0
def do_currency(price, code):
    return calculate(price, code)
Esempio n. 5
0
 def test_calculate_price_success_three_decimals(self):
     response = calculate('.5555', 'USD', decimals=3)
     self.assertEqual(response, Decimal('0.834'))
Esempio n. 6
0
 def render(self, context):
     try:
         return calculate(self.price.resolve(context), self.currency.resolve(context))
     except template.VariableDoesNotExist:
         return ''
Esempio n. 7
0
 def test_calculate_price_success(self):
     response = calculate('10', 'USD')
     self.assertEqual(response, Decimal('15.00'))
Esempio n. 8
0
 def test_calculate_price_success(self):
     response = calculate('10', 'USD')
     self.assertEqual(response, Decimal('15.00'))
Esempio n. 9
0
def do_currency(price, code):
    return calculate(price, code)
Esempio n. 10
0
def show_currency(price, code, decimals=2):
    return calculate(price, code, decimals=decimals)
Esempio n. 11
0
 def render(self, context):
     try:
         return calculate(self.price.resolve(context),
                          self.currency.resolve(context))
     except template.VariableDoesNotExist:
         return ''