def test_interpolate_three_missing(thermostat_type_1): s = pd.Series([8, np.nan, np.nan, np.nan, 1, 7]) s_intp = thermostat_type_1._interpolate(s) np.testing.assert_allclose(s_intp, [8,6.25,np.nan,2.75,1,7])
def test_interpolate_one_missing(thermostat_type_1): s5 = pd.Series([8, 3, np.nan, 1, 7]) s5_intp = thermostat_type_1._interpolate(s5) np.testing.assert_allclose(s5_intp, [8,3,2,1,7])
def test_interpolate_two_missing(thermostat_type_1): s6 = pd.Series([8, np.nan, np.nan, 1, 7]) s6_intp = thermostat_type_1._interpolate(s6) np.testing.assert_allclose(s6_intp, [8,5.666,3.333,1,7], rtol=1e-3)
def test_interpolate_forward(thermostat_type_1): s3 = pd.Series([1, np.nan]) s3_intp = thermostat_type_1._interpolate(s3) np.testing.assert_allclose(s3_intp, [1, 1])
def test_interpolate_backward(thermostat_type_1): s4 = pd.Series([np.nan, 1]) s4_intp = thermostat_type_1._interpolate(s4) np.testing.assert_allclose(s4_intp, [1, 1])
def test_interpolate_empty(thermostat_type_1): s1 = pd.Series([]) s1_intp = thermostat_type_1._interpolate(s1) np.testing.assert_allclose(s1_intp, [])
def test_interpolate_full(thermostat_type_1): s2 = pd.Series([1]) s2_intp = thermostat_type_1._interpolate(s2) np.testing.assert_allclose(s2_intp, [1])
def test_interpolate_two_missing(thermostat_type_1): s6 = pd.Series([8, np.nan, np.nan, 1, 7]) s6_intp = thermostat_type_1._interpolate(s6) np.testing.assert_allclose(s6_intp, [8, 5.666, 3.333, 1, 7], rtol=1e-3)
def test_interpolate_three_missing(thermostat_type_1): s = pd.Series([8, np.nan, np.nan, np.nan, 1, 7]) s_intp = thermostat_type_1._interpolate(s) np.testing.assert_allclose(s_intp, [8, 6.25, np.nan, 2.75, 1, 7])
def test_interpolate_one_missing(thermostat_type_1): s5 = pd.Series([8, 3, np.nan, 1, 7]) s5_intp = thermostat_type_1._interpolate(s5) np.testing.assert_allclose(s5_intp, [8, 3, 2, 1, 7])
def test_interpolate_full(thermostat_type_1): s2 = pd.Series([1]) s2_intp = thermostat_type_1._interpolate(s2) np.testing.assert_allclose(s2_intp, [1]) np.testing.assert_allclose(s2_intp, [1])