From e06626dbcabfc09300527df437d880276c38cbc7 Mon Sep 17 00:00:00 2001 From: Gourav Kumar Date: Tue, 5 Apr 2022 10:43:31 +0530 Subject: [PATCH] Added more ffill and bfill tests --- tests/test_fincal.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_fincal.py b/tests/test_fincal.py index 352d599..eea92b9 100644 --- a/tests/test_fincal.py +++ b/tests/test_fincal.py @@ -229,6 +229,23 @@ class TestTimeSeriesBasics: bf = ts.bfill() assert bf["2021-01-03"][1] == 240 + def test_fill_weekly(self): + ts_data = create_test_data(frequency=AllFrequencies.W, num=10) + ts_data.pop(2) + ts_data.pop(6) + ts = TimeSeries(ts_data, frequency="W") + assert len(ts) == 8 + + ff = ts.ffill() + assert len(ff) == 10 + assert "2017-01-15" in ff + assert ff["2017-01-15"][1] == ff["2017-01-08"][1] + + bf = ts.bfill() + assert len(ff) == 10 + assert "2017-01-15" in bf + assert bf["2017-01-15"][1] == bf["2017-01-22"][1] + class TestReturns: def test_returns_calc(self):