code: def test_extract_subseries(self):
      start_times = ["2020-01-01", "2020-06-01", "2020-09-01"]
      end_times = ["2020-01-31", "2020-07-31", "2020-09-28"]
  
      # Form a series without missing values between start_times and end_times
      time_index = pd.date_range(
          periods=365, freq="D", start=start_times[0]
      )
      pd_series = pd.Series(np.nan, index=time_index)
      for start, end in zip(start_times, end_times):
          pd_series[start:end] = 42
      series = TimeSeries.from_series(pd_series)
  
      subseries = extract_subseries(series)
  
      assert len(subseries) == len(start_times)
      for sub, start, end in zip(subseries, start_times, end_times):
          assert sub.start_time() == pd.to_datetime(start)
          assert sub.end_time() == pd.to_datetime(end)
  
      # Multivariate timeserie
      times = pd.date_range("20130206", "20130215")
      dataframe = pd.DataFrame(
          {
              "0": [1, 1, np.nan, 1, 2, 1, 1, 1, 1, 1],
              "1": [1, 1, np.nan, 1, 3, np.nan, np.nan, 1, 1, 1],
              "2": [
                  1,
                  1,
                  np.nan,
                  1,
                  4,
                  np.nan,
                  np.nan,
                  np.nan,
                  np.nan,
                  1,
              ],
          },
          index=times,
      )
      series = TimeSeries.from_dataframe(dataframe)
  
      # gaps is characterized by NaN in all the covariate columns
      subseries_all = extract_subseries(series, mode="all")
      assert len(subseries_all) == 2
      assert subseries_all[0] == series[:2]
      assert subseries_all[1] == series[3:]
  
      # gaps is characterized by NaN in any of the covariate columns
      subseries_any = extract_subseries(series, mode="any")
      assert len(subseries_any) == 3
      assert subseries_any[0] == series[:2]
      assert subseries_any[1] == series[3:5]
      assert subseries_any[2] == series[-1]
  
file_path: darts/darts/tests/utils/test_utils.py
imports: import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.utils import _with_sanity_checks, retain_period_common_to_all
  from darts.utils.missing_values import extract_subseries
label_desc: Use image node_id 3 for calling the TestUtils obj's underlying member method code with example usage: obj.test_extract_subseries() without return types