Esempio n. 1
0
    def testUSD(self):
        l10n_settings.set_l10n_setting('default_currency', 'USD')

        val = Decimal('10.00')
        self.assertEqual(moneyfmt(val), '$10.00')

        self.assertEqual(moneyfmt(val, currency_code='USD'), '$10.00')
Esempio n. 2
0
File: tests.py Progetto: 34/T
    def testUSD(self):
        l10n_settings.set_l10n_setting('default_currency', 'USD')
        
        val = Decimal('10.00')
        self.assertEqual(moneyfmt(val), '$10.00')

        self.assertEqual(moneyfmt(val, currency_code='USD'), '$10.00')
Esempio n. 3
0
    def testFake(self):
        currencies = l10n_settings.get_l10n_setting('currency_formats')
        currencies['FAKE'] = {'symbol': '^ ', 'positive' : "%(val)0.2f ^", 'negative': "(%(val)0.2f) ^", 'decimal' : ','}
        
        l10n_settings.set_l10n_setting('currency_formats', currencies)
        
        val = Decimal('10.00')
        self.assertEqual(moneyfmt(val, currency_code='FAKE'), '10,00 ^')

        val = Decimal('-50.00')
        self.assertEqual(moneyfmt(val, currency_code='FAKE'), '(50,00) ^')
Esempio n. 4
0
File: tests.py Progetto: 34/T
    def testFake(self):
        currencies = l10n_settings.get_l10n_setting('currency_formats')
        currencies['FAKE'] = {'symbol': '^ ', 'positive' : "%(val)0.2f ^", 'negative': "(%(val)0.2f) ^", 'decimal' : ','}
        
        l10n_settings.set_l10n_setting('currency_formats', currencies)
        
        val = Decimal('10.00')
        self.assertEqual(moneyfmt(val, currency_code='FAKE'), '10,00 ^')

        val = Decimal('-50.00')
        self.assertEqual(moneyfmt(val, currency_code='FAKE'), '(50,00) ^')