def test_datetime_attribute_timeseries_special_years(self, year):
        """Check that years with 53 weeks are is properly handled:
        - 1998 is a regular year starting on a thursday
        - 2020 is a leap year starting on a wednesday
        """

        start_date = pd.Timestamp(f"{year}-01-01")
        end_date = pd.Timestamp(f"{year}-12-31")

        # the 53th week appear when created with freq="D"
        weeks_special_year = 53
        index = pd.date_range(start=start_date, end=end_date, freq="D")
        assert index[-1].week == weeks_special_year
        vals_exp = np.zeros((len(index), weeks_special_year))
        # first week is incomplete, its length depend on the first day of the year
        week_shift = index[0].weekday()
        for week_index in range(weeks_special_year):
            week_start = max(7 * week_index - week_shift, 0)
            week_end = 7 * (week_index + 1) - week_shift
            vals_exp[week_start:week_end, week_index] = 1
        self.helper_routine(index, "week_of_year", vals_exp=vals_exp, one_hot=True)

        # the 53th week is omitted from index when created with freq="W"
        index_weeks = pd.date_range(start=start_date, end=end_date, freq="W")
        assert len(index_weeks) == weeks_special_year - 1
        # and 53th week properly excluded from the encoding
        vals_exp = np.eye(weeks_special_year - 1)[: len(index_weeks)]
        assert vals_exp.shape[1] == weeks_special_year - 1
        self.helper_routine(
            index_weeks, "week_of_year", vals_exp=vals_exp, one_hot=True
        )

        # extending the time index with the days missing from the incomplete first week
        index_weeks_ext = pd.date_range(
            start=start_date, end=end_date + pd.Timedelta(days=6 - week_shift), freq="W"
        )
        assert len(index_weeks_ext) == weeks_special_year
        # the 53th week is properly appearing in the encoding
        vals_exp = np.eye(weeks_special_year)
        assert vals_exp.shape[1] == weeks_special_year
        self.helper_routine(
            index_weeks_ext, "week_of_year", vals_exp=vals_exp, one_hot=True
        )
Check that years with 53 weeks are is properly handled:
        - 1998 is a regular year starting on a thursday
        - 2020 is a leap year starting on a wednesday
        
darts/tests/utils/test_timeseries_generation.py