diff --git a/tests/test_historical.py b/tests/test_historical.py index d68b803ac228c6e80929be2e22316942558bbf8a..fbf79ac97cba54470fa7ed0a3c5ae76309da743d 100644 --- a/tests/test_historical.py +++ b/tests/test_historical.py @@ -146,3 +146,16 @@ def test_from_denomination(historical1_responder, output): assert next(lines) == '$10.00\n' assert next(lines) == '1,445 ALL {=$0.006919} @ $0.006919\n' assert next(lines, None) is None + +def test_rate_precision_added_as_needed(historical1_responder, output): + config = build_config(historical1_responder, from_currency='RUB', + to_currency='USD', amount=63805, + ledger=True, denomination='USD') + lines = lines_from_run(config, output) + # 63,805 / 57.0763 (the RUB rate) == $1,117.89 + # But using the truncated rate: 63,805 * .01752 == $1,117.86 + # Make sure the rate is specified with enough precision to get the + # correct conversion amount. + assert next(lines) == '63,805.00 RUB {=$0.0175204} @ $0.0175204\n' + assert next(lines) == '$1,117.89\n' + assert next(lines, None) is None