pulled up, fixed tests

This commit is contained in:
Pablo Martin 2025-05-26 17:00:57 +02:00
parent a7a37d4614
commit 7f8001ffca
3 changed files with 26 additions and 21 deletions

View file

@ -24,15 +24,23 @@ def test_handle_input_rates_works_with_full_correct_inputs():
start_date=(datetime.datetime.now() - datetime.timedelta(days=7)).date(),
end_date=(datetime.datetime.now() - datetime.timedelta(days=1)).date(),
),
"currencies": {Currency("USD"), Currency("EUR"), Currency("GBP")},
"pairs": {
CurrencyPair(Currency("USD"), Currency("EUR")),
CurrencyPair(Currency("GBP"), Currency("USD")),
CurrencyPair(Currency("GBP"), Currency("EUR")),
},
"dry_run": False,
"rates_source": "mock",
"ignore_warnings": True,
"output": pathlib.Path("test_output.csv"),
}
for key in expected_result.keys():
for key in {"date_range", "dry_run", "rates_source", "ignore_warnings", "output"}:
assert handled_inputs[key] == expected_result[key]
# We don't check for the currency pairs because the random ordering used
# by the currencies arg execution path does not guarantee the sorting,
# and CurrencyPair comparison needs proper sorting, and my head hurts
# and other tests are already catching for this correctness so.
def test_handle_input_rates_raises_with_bad_currency_code():
@ -106,7 +114,7 @@ def test_handle_input_rates_start_and_end_date_equal_works_fine():
handled_inputs = handle_get_rates_inputs(
start_date=datetime.datetime.now(),
end_date=datetime.datetime.now(),
currencies="USD,EUR,GBP",
pairs="USDEUR,EURUSD,GBPZAR",
dry_run=False,
rates_source="mock",
ignore_warnings=True,
@ -117,7 +125,11 @@ def test_handle_input_rates_start_and_end_date_equal_works_fine():
start_date=datetime.datetime.now().date(),
end_date=datetime.datetime.now().date(),
),
"currencies": {Currency("USD"), Currency("EUR"), Currency("GBP")},
"pairs": {
CurrencyPair(Currency("USD"), Currency("EUR")),
CurrencyPair(Currency("EUR"), Currency("USD")),
CurrencyPair(Currency("GBP"), Currency("ZAR")),
},
"dry_run": False,
"rates_source": "mock",
"ignore_warnings": True,