code: def test_fill_missing_dates():
      """Tests fill_missing_dates function"""
      df = pd.DataFrame(
          {
              "time": [
                  datetime.datetime(2018, 1, 1, 0, 0, 1),
                  datetime.datetime(2018, 1, 1, 0, 0, 2),
                  datetime.datetime(
                      2018, 1, 1, 0, 0, 10
                  ),  # intentionally out of order
                  datetime.datetime(2018, 1, 1, 0, 0, 4),
              ],
              VALUE_COL: [1, 2, 3, 4],
          }
      )
  
      expected = pd.DataFrame(
          {
              "time": [
                  datetime.datetime(2018, 1, 1, 0, 0, 1),
                  datetime.datetime(2018, 1, 1, 0, 0, 2),
                  datetime.datetime(2018, 1, 1, 0, 0, 3),
                  datetime.datetime(2018, 1, 1, 0, 0, 4),
                  datetime.datetime(2018, 1, 1, 0, 0, 5),
                  datetime.datetime(2018, 1, 1, 0, 0, 6),
                  datetime.datetime(2018, 1, 1, 0, 0, 7),
                  datetime.datetime(2018, 1, 1, 0, 0, 8),
                  datetime.datetime(2018, 1, 1, 0, 0, 9),
                  datetime.datetime(2018, 1, 1, 0, 0, 10),
              ],
              VALUE_COL: [
                  1,
                  2,
                  np.nan,
                  4,
                  np.nan,
                  np.nan,
                  np.nan,
                  np.nan,
                  np.nan,
                  3,
              ],
          }
      )
      (
          df_filled,
          added_timepoints,
          dropped_timepoints,
      ) = fill_missing_dates(df, time_col="time", freq="S")
      assert df_filled.equals(expected)
      assert added_timepoints == 6
      assert dropped_timepoints == 0
  
      # warns when wrong frequency provided, data points dropped
      with pytest.warns(UserWarning) as record:
          (
              df_filled,
              added_timepoints,
              dropped_timepoints,
          ) = fill_missing_dates(df, time_col="time", freq="MS")
          assert added_timepoints == 0  # keeps the first record
          assert dropped_timepoints == 3
          assert (
              f"Dropped {dropped_timepoints} dates when filling gaps in input data"
              in record[0].message.args[0]
          )
  
imports: import datetime
  import numpy
  import pandas
  import pytest
  from greykite.common.constants import ADJUSTMENT_DELTA_COL
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import METRIC_COL
  from greykite.common.constants import START_TIME_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.data_loader import DataLoader
  from greykite.common.enums import TimeEnum
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import generate_df_with_reg_for_tests
  from greykite.common.time_properties import describe_timeseries
  from greykite.common.time_properties import fill_missing_dates
  from greykite.common.time_properties import find_missing_dates
  from greykite.common.time_properties import get_canonical_data
  from greykite.common.time_properties import infer_freq
  from greykite.common.time_properties import min_gap_in_seconds
label_desc: Use image node_id 4 for calling a global function with example usage: test_fill_missing_dates() without return types