def test_fill_back1(): testing_df =df.copy() clean.fillDown(testing_df, 0, 1, 'bfill') res = {'col1' : pd.Series([1., 2., 3., 3., 4.], index=[0, 1, 2, 3, 4]), 'col2' : pd.Series([1., 2., 2., 4., 4.], index=[0, 1, 2, 3, 4]), 'col3' : pd.Series([1., 2., 3., 4., 5.,])} df_res = pd.DataFrame(res) assert (((testing_df.fillna(0) == df_res.fillna(0)).all()).all()) == True
def test_fill_back2(): testing_df = df.copy() clean.fillDown(testing_df, 2, 2, 'bfill') assert (((testing_df.fillna(0) == df.fillna(0)).all()).all()) == True
def test_fill_pad4(): testing_df = df.copy() clean.fillDown(testing_df, 1, 0,'pad') with pytest.raises(Exception): clean.fillDown(testing_df, 3, 3, 'pad')
def test_fill_pad3(): testing_df = df.copy with pytest.raises(Exception): clean.fillDown(testing_df, 4, 4, 'pad')