Changeset - 42d2002fda44
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-06-21 15:39:31
brettcsmith@brettcsmith.org
reports: Balance.format(None) uses accounting formats.
2 files changed with 7 insertions and 5 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/core.py
Show inline comments
...
 
@@ -233,4 +233,5 @@ class Balance(Mapping[str, data.Amount]):
 
            return sep.join(
 
                babel.numbers.format_currency(amt.number, amt.currency, fmt)
 
                for amt in amounts
 
                babel.numbers.format_currency(
 
                    amt.number, amt.currency, fmt, format_type='accounting',
 
                ) for amt in amounts
 
            )
tests/test_reports_balance.py
Show inline comments
...
 
@@ -421,6 +421,7 @@ def test_format_sep(sep):
 

	
 
def test_format_none():
 
    args = (65000, 'BRL')
 
@pytest.mark.parametrize('number', [65000, -77000])
 
def test_format_none(number):
 
    args = (number, 'BRL')
 
    balance = core.Balance([testutil.Amount(*args)])
 
    expected = babel.numbers.format_currency(*args)
 
    expected = babel.numbers.format_currency(*args, format_type='accounting')
 
    assert balance.format(None) == expected
0 comments (0 inline, 0 general)