File diff 8dede9d1398c → ae3e4617d31e
tests/test_historical.py
Show inline comments
...
 
@@ -239,3 +239,24 @@ def test_from_date_conversion(alternate_responder, output, any_date, output_form
 
    check_fx_amount(config, lines, '10.00 ANG', '0.558', 'USD', '$', '0.507')
 
    check_fx_amount(config, lines, '20.52 AED', '0.272', 'USD', '$', '0.265')
 
    assert next(lines, None) is None
 

	
 
@parametrize_format
 
def test_rate_consistent_as_cost_and_price(alternate_responder, any_date, output_format):
 
    config_kwargs = {
 
        'responder': alternate_responder,
 
        'amount': 65000,
 
        'from_currency': 'RUB',
 
        'output_format': output_format,
 
        'signed_currencies': (),
 
    }
 
    config = build_config(date=any_date, **config_kwargs)
 
    with io.StringIO() as output:
 
        lines = lines_from_run(config, output)
 
        match = re.search(r'\{=?(\d+\.\d+ USD)\}', next(lines, "<EOF>"))
 
    assert match
 
    expect_rate = f' @ {match.group(1)}\n'
 
    future_date = any_date.replace(year=any_date.year + 1)
 
    config = build_config(date=future_date, from_date=any_date, **config_kwargs)
 
    with io.StringIO() as output:
 
        lines = lines_from_run(config, output)
 
        assert next(lines, "<EOF>").endswith(expect_rate)