def test_integer(self):
        self.assertEqual(
            format_currency(
                '12345678', decimal_mark='.', thousands_separator=','),
            '12,345,678')

        self.assertEqual(
            format_currency(
                12345678, decimal_mark='.', thousands_separator=','),
            '12,345,678')
Exemple #2
0
 def get_readable_price(self):
     registry = getUtility(IRegistry)
     currency = registry.records["ftw.billboard.currency"]
     decimal_mark = registry.records["ftw.billboard.decimalmark"]
     thousandsseperator = registry.records["ftw.billboard.thousandsseparator"]
     formated_value = format_currency(
         self.context.getPrice(), decimal_mark=decimal_mark.value, thousands_separator=thousandsseperator.value
     )
     return formated_value + " " + currency.value
 def test_big_number(self):
     self.assertEqual(
         format_currency(
             12345678.912, decimal_mark='.', thousands_separator=','),
         '12,345,678.91')
 def test_only_float(self):
     self.assertEqual(
         format_currency('.123', decimal_mark='.', thousands_separator=','),
         '0.12')
 def test_small_number(self):
     self.assertEqual(
         format_currency(234.56, decimal_mark='.', thousands_separator=','),
         '234.56')
 def test_default(self):
     self.assertEqual(
         format_currency(1234.56),
         '1234.56')
 def test_string(self):
     self.assertEqual(
         format_currency(
             '12345678.91', decimal_mark='.', thousands_separator=','),
         '12,345,678.91')