def helper_test_index_generator_train(self, ig: CovariatesIndexGenerator):
        """
        If covariates are given, the index generators should return the covariate series' index.
        If covariates are not given, the index generators should return the target series' index.
        """
        # pd.DatetimeIndex
        # generated index must be equal to input covariate index
        idx, _ = ig.generate_train_idx(self.target_time, self.cov_time_train)
        assert idx.equals(self.cov_time_train.time_index)
        # generated index must be equal to input covariate index
        idx, _ = ig.generate_train_idx(self.target_time, self.cov_time_train_short)
        assert idx.equals(self.cov_time_train_short.time_index)
        # generated index must be equal to input target index when no covariates are defined
        idx, _ = ig.generate_train_idx(self.target_time, None)
        assert idx[0] == self.target_time.start_time()
        if isinstance(ig, PastCovariatesIndexGenerator):
            assert (
                idx[-1]
                == self.target_time.end_time()
                - self.output_chunk_length * self.target_time.freq
            )
        else:
            assert idx[-1] == self.target_time.end_time()

        # integer index
        # generated index must be equal to input covariate index
        idx, _ = ig.generate_train_idx(self.target_int, self.cov_int_train)
        assert idx.equals(self.cov_int_train.time_index)
        # generated index must be equal to input covariate index
        idx, _ = ig.generate_train_idx(self.target_int, self.cov_int_train_short)
        assert idx.equals(self.cov_int_train_short.time_index)
        # generated index must be equal to input target index when no covariates are defined
        idx, _ = ig.generate_train_idx(self.target_int, None)
        assert idx[0] == self.target_int.start_time()
        if isinstance(ig, PastCovariatesIndexGenerator):
            assert (
                idx[-1]
                == self.target_int.end_time()
                - self.output_chunk_length * self.target_int.freq
            )
        else:
            assert idx[-1] == self.target_int.end_time()

        If covariates are given, the index generators should return the covariate series' index.
        If covariates are not given, the index generators should return the target series' index.
        
darts/tests/dataprocessing/encoders/test_covariate_index_generators.py