Added more ffill and bfill tests

This commit is contained in:
Gourav Kumar 2022-04-05 10:43:31 +05:30
parent 33feb62015
commit e06626dbca

View File

@ -229,6 +229,23 @@ class TestTimeSeriesBasics:
bf = ts.bfill() bf = ts.bfill()
assert bf["2021-01-03"][1] == 240 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: class TestReturns:
def test_returns_calc(self): def test_returns_calc(self):