From 9e4049a9732f9b67e8a48347d1d63999d813c047 Mon Sep 17 00:00:00 2001 From: Gourav Kumar Date: Fri, 25 Feb 2022 09:47:53 +0530 Subject: [PATCH] One more test for date format --- tests/test_fincal.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_fincal.py b/tests/test_fincal.py index b169040..f45ea64 100644 --- a/tests/test_fincal.py +++ b/tests/test_fincal.py @@ -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