Example #1
0
 def test_format_currency(self):
     value_expected_pairs = [['199990', '$199.990'], ['990', '$990'],
                             ['29.95', '$29,95'], ['1010990', '$1.010.990'],
                             ['-0.99', '-$0,99']]
     for decimal_string, expected_value in value_expected_pairs:
         value = Decimal(decimal_string)
         self.assertEqual(expected_value, format_currency(value))
Example #2
0
    def __unicode__(self):
        result = u'{0} - {1} ({2})\n{3}\n'.format(self.store, self.name,
                                                  self.type, self.url)
        if self.payment_method_prices:
            for option in self.payment_method_prices.items():
                result += u'{0}: {1}\n'.format(option[0],
                                               format_currency(option[1]))
        else:
            result += u'Not available\n'

        return result