Example #1
0
    def test_get_money_with_currency_format(self):
        currency = Currency('USD')

        self.assertEqual(currency.get_money_with_currency_format(13.99),
                         '$13.99 USD')
        self.assertEqual(currency.get_money_with_currency_format('13,2313,33'),
                         '$13,2313,33 USD')
Example #2
0
    def test_set_money_currency(self):
        currency = Currency('USD')

        self.assertEqual(currency.get_money_currency(), 'USD')
        self.assertEqual(currency.get_money_format(13), '$13')

        currency.set_money_currency('AED')

        self.assertEqual(currency.get_money_currency(), 'AED')
        self.assertEqual(currency.get_money_format(13), 'Dhs. 13')
Example #3
0
 def to_representation(self, price):
     currency = Currency('BRL')
     return currency.get_money_format(price)
Example #4
0
    def test_get_money_currency(self):
        currency = Currency('USD')

        self.assertIsInstance(currency.get_money_currency(), str)
        self.assertEqual(currency.get_money_currency(), 'USD')
Example #5
0
#!/usr/bin/env python
# encoding: utf-8
'''
@author:maidou
@contact:QQ4113291000
@time:2018/4/28.上午11:13
'''
'''
显示货币格式以及它的数值
'''
from currencies import Currency

currency = Currency('USD')
print currency.get_money_format(13)
print currency.get_money_format('13,2313,33')
print currency.get_money_format('13,231,333')
print currency.get_money_with_currency_format(13.99)

if __name__ == '__main__':
    pass