def test_period_index_series_unchanged( self, period_index_series: pd.Series, start: datetime, freq: pd.Timedelta, ): time_series_preparation = TimeSeriesPreparation(start=start, freq=freq) computed_time_series = time_series_preparation._to_time_index_series( period_index_series ) assert_series_equal(computed_time_series, period_index_series)
def test_list_as_input( self, input_list: pd.Series, start: datetime, freq: pd.Timedelta, ): time_series_preparation = TimeSeriesPreparation(start=start, freq=freq) computed_time_series = time_series_preparation._to_time_index_series(input_list) expected_time_series = pandas_series_with_period_index( input_list, start, freq=freq ) assert_series_equal(computed_time_series, expected_time_series)
def test_timedelta_index_dataframe_unchanged( self, timedelta_index_series: pd.Series, start: datetime, freq: pd.Timedelta, ): timedelta_index_dataframe = pd.DataFrame(timedelta_index_series) time_series_preparation = TimeSeriesPreparation(start=start, freq=freq) computed_time_series = time_series_preparation._to_time_index_series( timedelta_index_dataframe ) assert_series_equal(computed_time_series, timedelta_index_series)
def test_wrong_input_type(self, wrong_input: Tuple): time_series_preparation = TimeSeriesPreparation() with pytest.raises(TypeError): time_series_preparation._to_time_index_series(wrong_input)