Changeset - c3fd55ec15b7
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-05-19 19:22:00
brettcsmith@brettcsmith.org
historical: Beancount can handle commas in amounts.

And having it looks nicer, is more consistent with our historical
books, is less code for me, and is no more trouble for the user.
2 files changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
oxrlib/commands/historical.py
Show inline comments
...
 
@@ -178,3 +178,3 @@ class BeancountFormatter(LedgerFormatter):
 
    def __init__(self, cost_rates, price_rates=None,
 
                 signed_currencies=(), base_fmt='###0.###',
 
                 signed_currencies=(), base_fmt='#,##0.###',
 
                 rate_precision=5, denomination=None):
...
 
@@ -184,3 +184,3 @@ class BeancountFormatter(LedgerFormatter):
 
            (),
 
            base_fmt.replace(',', ''),
 
            base_fmt,
 
            rate_precision,
tests/test_historical.py
Show inline comments
...
 
@@ -97,3 +97,2 @@ def check_fx_amount(config, lines, amount, cost, fx_code, fx_sign=None, price=No
 
    else:
 
        amount = amount.replace(',', '')
 
        cost_re = '{{{}}}'.format(rate_fmt.format(cost))
...
 
@@ -117,3 +116,3 @@ def check_nonfx_amount(config, lines, amount, code=None, sign=None):
 
    else:
 
        expected = f'{amount.replace(",", "")} {code or "USD"}\n'
 
        expected = f'{amount} {code or "USD"}\n'
 
    assert next(lines, "<EOF>") == expected
0 comments (0 inline, 0 general)