tests: Make consistent rate test a little more robust.

This commit is contained in:
Brett Smith 2020-05-20 15:35:27 -04:00
parent c9382a2604
commit 77393ee80f

View file

@ -252,10 +252,10 @@ def test_rate_consistent_as_cost_and_price(alternate_responder, any_date, output
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 is not None
amount, _, _ = next(lines).partition('@')
expected = amount.replace('\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 match.group(0) in next(lines, "<EOF>")
assert next(lines, "<EOF>").startswith(expected)