code: def test_clean_time_index_str_datetime(freq, index):
      """Test clean_time_index utility when index/column is of type str in format
      acceptable to DatetimeIndex
  
      NOTE: Index can not be string (only column). Code unchanges, just parameter
      restricted to False
      """
      dates = pd.date_range(
          "2019-01-01 00:00:00", "2022-01-30 00:00:00", freq=freq
      )
  
      # At least 3 data points to allow test to insert a missing index in the middle
      # but not so many data points that the code slows down too much.
      if len(dates) > 100:
          dates = dates[:100]
      assert len(dates) >= 3
      dates = dates.strftime("%Y-%m-%d %H:%M:%S")
  
      data = pd.DataFrame(
          {
              "date": dates,
              "value": np.random.rand(len(dates)),
          }
      )
      if index:
          data.set_index("date", inplace=True)
          index_col = None
      else:
          index_col = "date"
  
      # -------------------------------------------------------------------------#
      # Test 1: Cleaning without any missing time index
      # -------------------------------------------------------------------------#
      try:
          cleaned = clean_time_index(
              data=data, index_col=index_col, freq=freq
          )
      except AttributeError:
          # Unsupported freq conversion from DatetimeIndex to PeriodIndex
          return
      assert len(cleaned) == len(data)
  
      # -------------------------------------------------------------------------#
      # Test 2: Cleaning with any missing time index
      # -------------------------------------------------------------------------#
      # Drop 2nd row
      data_missing = data.copy()
      data_missing = data_missing.drop(data_missing.index[1])
      cleaned = clean_time_index(
          data=data_missing, index_col=index_col, freq=freq
      )
      # Datetime Index missing values are filled in  by clean_time_index
      assert len(cleaned) == len(data)
  
file_path: pycaret/tests/test_time_series_utils.py
imports: import numpy
  import pandas
  import pytest
  from pycaret.utils.time_series import SeasonalPeriod, clean_time_index, remove_harmonics_from_sp
label_desc: Use image node_id 4 for calling a global function with example usage: test_clean_time_index_str_datetime(freq, index) without return types