One more test for date format

This commit is contained in:
Gourav Kumar 2022-02-25 09:47:53 +05:30
parent f4e7840f28
commit 9e4049a973

View File

@ -221,3 +221,11 @@ class TestReturns:
returns1 = ts.calculate_returns("2020-04-10", interval_type='days', interval_value=90, date_format='%Y-%m-%d')
returns2 = ts.calculate_returns("10-04-2020", interval_type='days', interval_value=90)
assert round(returns1, 4) == round(returns2, 4) == 5.727
FincalOptions.date_format = '%m-%d-%Y'
with pytest.raises(ValueError):
ts.calculate_returns("2020-04-10", compounding=True, interval_type='days', interval_value=90)
returns1 = ts.calculate_returns("2020-04-10", interval_type='days', interval_value=90, date_format='%Y-%m-%d')
returns2 = ts.calculate_returns("04-10-2020", interval_type='days', interval_value=90)
assert round(returns1, 4) == round(returns2, 4) == 5.727