コード例 #1
0
ファイル: amount_test.py プロジェクト: glasmasin/moneyguru
def test_parse_currencies_with_large_exponents():
    # Dinars have 3 decimal places, making them awkward to parse because for "normal" currencies, we
    # specifically look for 2 digits after the separator to avoid confusion with thousand sep. For
    # dinars, however, we look for 3 digits adter the decimal sep. So yes, we are vulnerable to
    # confusion with the thousand sep, but well, there isn't much we can do about that.
    eq_(parse_amount('1,000 BHD'), Amount(1, BHD))
    # Moreover, with custom currencies, we might have currencies with even bigger exponent.
    ABC = Currency.register('ABC', 'My foo currency', exponent=5)
    eq_(parse_amount('1.23456 abc'), Amount(1.23456, ABC))
コード例 #2
0
ファイル: plugin.py プロジェクト: prodigeni/moneyguru
 def __init__(self):
     Plugin.__init__(self)
     self.supported_currency_codes = set()
     for code, name, exponent, fallback_rate in self.register_currencies():
         Currency.register(code, name, exponent, latest_rate=fallback_rate)
         self.supported_currency_codes.add(code)