Change from "$xx" to "xx USD" to fix tests

This commit is contained in:
Ben Sturmfels 2025-09-19 17:55:41 +10:00
parent 61b9683743
commit 7aad059d3d
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
4 changed files with 19 additions and 21 deletions

View file

@ -1,6 +1,6 @@
[DEFAULT] [DEFAULT]
date_format = %%Y-%%m-%%d date_format = %%Y-%%m-%%d
signed_currencies = USD, CAD signed_currencies = CAD
signed_currency_format = ¤#,##0.### signed_currency_format = ¤#,##0.###
unsigned_currency_format = #,##0.### ¤¤ unsigned_currency_format = #,##0.### ¤¤

View file

@ -1,7 +1,7 @@
[DEFAULT] [DEFAULT]
default_date = 2016/04/04 default_date = 2016/04/04
loglevel = critical loglevel = critical
signed_currencies = USD signed_currencies =
[One] [One]
patreon cardfees ledger entry = patreon cardfees ledger entry =

View file

@ -1,19 +1,19 @@
2017/09/01 Patreon 2017/09/01 Patreon
Accrued:Accounts Receivable $-52.47 Accrued:Accounts Receivable -52.47 USD
Expenses:Fees:Credit Card $52.47 Expenses:Fees:Credit Card 52.47 USD
2017/10/01 Patreon 2017/10/01 Patreon
Accrued:Accounts Receivable $-99.47 Accrued:Accounts Receivable -99.47 USD
Expenses:Fees:Credit Card $99.47 Expenses:Fees:Credit Card 99.47 USD
2017/09/01 Patreon 2017/09/01 Patreon
;SourcePath: {source_abspath} ;SourcePath: {source_abspath}
;SourceName: {source_name} ;SourceName: {source_name}
Accrued:Accounts Receivable $-61.73 Accrued:Accounts Receivable -61.73 USD
Expenses:Fundraising $61.73 Expenses:Fundraising 61.73 USD
2017/10/01 Patreon 2017/10/01 Patreon
;SourcePath: {source_abspath} ;SourcePath: {source_abspath}
;SourceName: {source_name} ;SourceName: {source_name}
Accrued:Accounts Receivable $-117.03 Accrued:Accounts Receivable -117.03 USD
Expenses:Fundraising $117.03 Expenses:Fundraising 117.03 USD

View file

@ -60,7 +60,7 @@ def test_date_formatting():
def test_currency_formatting(): def test_currency_formatting():
tmpl = template_from('Simplest', signed_currencies=['USD']) tmpl = template_from('Simplest', signed_currencies=['USD'])
assert_easy_render(tmpl, 'CC', '7.99', 'USD', '2015/03/14', '$7.99') assert_easy_render(tmpl, 'CC', '7.99', 'USD', '2015/03/14', 'USD7.99')
def test_empty_template(): def test_empty_template():
tmpl = ledger_entry.Template("\n \n") tmpl = ledger_entry.Template("\n \n")
@ -76,19 +76,18 @@ def test_complex_template():
lines = render_lines( lines = render_lines(
render_vars, 'Complex', render_vars, 'Complex',
date_fmt='%Y-%m-%d', date_fmt='%Y-%m-%d',
signed_currencies=['USD'],
) )
assert lines == [ assert lines == [
"", "",
"2015-03-14 TT", "2015-03-14 TT",
" ;Tag: Value", " ;Tag: Value",
" ;TransactionID: ABCDEF", " ;TransactionID: ABCDEF",
" Accrued:Accounts Receivable $125.50", " Accrued:Accounts Receivable 125.50 USD",
" ;Entity: Supplier", " ;Entity: Supplier",
" Income:Donations:Spectrum Defense $-119.85", " Income:Donations:Spectrum Defense -119.85 USD",
" ;Program: Spectrum Defense", " ;Program: Spectrum Defense",
" ;Entity: T-T", " ;Entity: T-T",
" Income:Donations:General $-5.65", " Income:Donations:General -5.65 USD",
" ;Entity: T-T", " ;Entity: T-T",
] ]
@ -108,19 +107,18 @@ def test_variable_whitespace_cleaned():
lines = render_lines( lines = render_lines(
render_vars, 'Complex', render_vars, 'Complex',
date_fmt='%Y-%m-%d', date_fmt='%Y-%m-%d',
signed_currencies=['USD'],
) )
assert lines == [ assert lines == [
"", "",
"2015-03-14 W S", "2015-03-14 W S",
" ;Tag: Value", " ;Tag: Value",
" ;TransactionID: ABC DEF", " ;TransactionID: ABC DEF",
" Accrued:Accounts Receivable $125.50", " Accrued:Accounts Receivable 125.50 USD",
" ;Entity: Supplier", " ;Entity: Supplier",
" Income:Donations:Spectrum Defense $-119.85", " Income:Donations:Spectrum Defense -119.85 USD",
" ;Program: Spectrum Defense", " ;Program: Spectrum Defense",
" ;Entity: W S", " ;Entity: W S",
" Income:Donations:General $-5.65", " Income:Donations:General -5.65 USD",
" ;Entity: W S", " ;Entity: W S",
] ]
@ -342,8 +340,8 @@ def test_hook_renders_template():
assert lines == [ assert lines == [
"", "",
"2015-03-14 BB", "2015-03-14 BB",
" Accrued:Accounts Receivable $0.99", " Accrued:Accounts Receivable 0.99 USD",
" Income:Donations -$0.99", " Income:Donations -0.99 USD",
] ]
def test_hook_handles_empty_template(): def test_hook_handles_empty_template():