コード例 #1
0
ファイル: tests.py プロジェクト: panosl/django-currencies
 def test_calculate_price_success(self):
     response = calculate("10", "USD")
     self.assertEqual(response, Decimal("15.00"))
コード例 #2
0
ファイル: tests.py プロジェクト: panosl/django-currencies
 def test_calculate_price_success_three_decimals(self):
     response = calculate(".5555", "USD", decimals=3)
     self.assertEqual(response, Decimal("0.834"))
コード例 #3
0
ファイル: currency.py プロジェクト: panosl/django-currencies
def show_currency(price, code, decimals=2):
    return calculate(price, code, decimals=decimals)
コード例 #4
0
ファイル: currency.py プロジェクト: panosl/django-currencies
def do_currency(price, code):
    return calculate(price, code)
コード例 #5
0
ファイル: tests.py プロジェクト: codigojs/django-currencies
 def test_calculate_price_success_three_decimals(self):
     response = calculate('.5555', 'USD', decimals=3)
     self.assertEqual(response, Decimal('0.834'))
コード例 #6
0
ファイル: currency.py プロジェクト: panosl/django-currencies
 def render(self, context):
     try:
         return calculate(self.price.resolve(context), self.currency.resolve(context))
     except template.VariableDoesNotExist:
         return ''
コード例 #7
0
ファイル: tests.py プロジェクト: codigojs/django-currencies
 def test_calculate_price_success(self):
     response = calculate('10', 'USD')
     self.assertEqual(response, Decimal('15.00'))
コード例 #8
0
ファイル: tests.py プロジェクト: ZettaIO/django-currencies
 def test_calculate_price_success(self):
     response = calculate('10', 'USD')
     self.assertEqual(response, Decimal('15.00'))
コード例 #9
0
def do_currency(price, code):
    return calculate(price, code)
コード例 #10
0
def show_currency(price, code, decimals=2):
    return calculate(price, code, decimals=decimals)
コード例 #11
0
 def render(self, context):
     try:
         return calculate(self.price.resolve(context),
                          self.currency.resolve(context))
     except template.VariableDoesNotExist:
         return ''