code: def test_holidays_timeseries(self):
      time_index_1 = pd.date_range(
          periods=365 * 3, freq="D", start=pd.Timestamp("2012-01-01")
      )
      time_index_2 = pd.date_range(
          periods=365 * 3, freq="D", start=pd.Timestamp("2014-12-24")
      )
      time_index_3 = pd.date_range(
          periods=10, freq="Y", start=pd.Timestamp("1950-01-01")
      ) + pd.Timedelta(days=1)
  
      # testing we have at least one holiday flag in each year
      def test_routine(
          time_index,
          country_code,
          until: Union[int, pd.Timestamp, str] = 0,
          add_length=0,
      ):
          ts = holidays_timeseries(
              time_index,
              country_code,
              until=until,
              add_length=add_length,
          )
          assert all(
              ts.pd_dataframe()
              .groupby(pd.Grouper(freq="y"))
              .sum()
              .values
          )
  
      for time_index in [time_index_1, time_index_2, time_index_3]:
          for country_code in ["US", "CH", "AR"]:
              test_routine(time_index, country_code)
  
      # test extend time index
      test_routine(time_index_1, "US", add_length=365)
      test_routine(time_index_1, "CH", until="2016-01-01")
      test_routine(time_index_1, "CH", until="20160101")
      test_routine(time_index_1, "AR", until=pd.Timestamp("2016-01-01"))
  
      # test overflow
      with pytest.raises(ValueError):
          holidays_timeseries(time_index_1, "US", add_length=99999)
  
      # test date is too short
      with pytest.raises(ValueError):
          holidays_timeseries(time_index_2, "US", until="2016-01-01")
  
      # test wrong timestamp
      with pytest.raises(ValueError):
          holidays_timeseries(time_index_3, "US", until=163)
  
      # test non time zone-naive
      with pytest.raises(ValueError):
          holidays_timeseries(
              time_index_3.tz_localize("UTC"), "US", until=163
          )
  
      # test holiday with and without time zone, 1st of August is national holiday in Switzerland
      # time zone naive (e.g. in UTC)
      idx = generate_index(
          start=pd.Timestamp("2000-07-31 22:00:00"), length=3, freq="h"
      )
      ts = holidays_timeseries(idx, country_code="CH")
      np.testing.assert_array_almost_equal(
          ts.values()[:, 0], np.array([0, 0, 1])
      )
  
      # time zone CET (+2 hour compared to UTC)
      ts = holidays_timeseries(idx, country_code="CH", tz="CET")
      np.testing.assert_array_almost_equal(
          ts.values()[:, 0], np.array([1, 1, 1])
      )
  
      # check same from TimeSeries
      series = TimeSeries.from_times_and_values(
          times=idx, values=np.arange(len(idx))
      )
      ts = holidays_timeseries(series, country_code="CH", tz="CET")
      np.testing.assert_array_almost_equal(
          ts.values()[:, 0], np.array([1, 1, 1])
      )
  
file_path: darts/darts/tests/utils/test_timeseries_generation.py
imports: from typing import Union
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.utils.timeseries_generation import autoregressive_timeseries, constant_timeseries, datetime_attribute_timeseries, gaussian_timeseries, generate_index, holidays_timeseries, linear_timeseries, random_walk_timeseries, sine_timeseries
label_desc: Use image node_id 6 for calling the TestTimeSeriesGeneration obj's underlying member method code with example usage: obj.test_holidays_timeseries() without return types