docstr: For prediction (`n` is given) with past covariates we have to distinguish between two cases:
  1)  if past covariates are given, we can use them as reference
  2)  if past covariates are missing, we need to generate a time index that starts `input_chunk_length`
      before the end of `target` and ends `max(0, n - output_chunk_length)` after the end of `target`
  
  For prediction (`n` is given) with future covariates we have to distinguish between two cases:
  1)  if future covariates are given, we can use them as reference
  2)  if future covariates are missing, we need to generate a time index that starts `input_chunk_length`
      before the end of `target` and ends `max(n, output_chunk_length)` after the end of `target`
docstr_tok: ["For","prediction","(","`","n","`","is","given",")","with","past","covariates","we","have","to","distinguish","between","two","cases",":","1",")","if","past","covariates","are","given",",","we","can","use","them","as","reference","2",")","if","past","covariates","are","missing",",","we","need","to","generate","a","time","index","that","starts","`","input_chunk_length","`","before","the","end","of","`","target","`","and","ends","`","max","(","0",",","n","-","output_chunk_length",")","`","after","the","end","of","`","target","`","For","prediction","(","`","n","`","is","given",")","with","future","covariates","we","have","to","distinguish","between","two","cases",":","1",")","if","future","covariates","are","given",",","we","can","use","them","as","reference","2",")","if","future","covariates","are","missing",",","we","need","to","generate","a","time","index","that","starts","`","input_chunk_length","`","before","the","end","of","`","target","`","and","ends","`","max","(","n",",","output_chunk_length",")","`","after","the","end","of","`","target","`"]
code: def helper_test_index_generator_inference(self, ig, is_past=False):
      """
      For prediction (`n` is given) with past covariates we have to distinguish between two cases:
      1)  if past covariates are given, we can use them as reference
      2)  if past covariates are missing, we need to generate a time index that starts `input_chunk_length`
          before the end of `target` and ends `max(0, n - output_chunk_length)` after the end of `target`
  
      For prediction (`n` is given) with future covariates we have to distinguish between two cases:
      1)  if future covariates are given, we can use them as reference
      2)  if future covariates are missing, we need to generate a time index that starts `input_chunk_length`
          before the end of `target` and ends `max(n, output_chunk_length)` after the end of `target`
      """
  
      # check generated inference index without passing covariates when n <= output_chunk_length
      idx, _ = ig.generate_inference_idx(
          self.n_short, self.target_time, None
      )
      if is_past:
          n_out = self.input_chunk_length
          last_idx = self.target_time.end_time()
      else:
          n_out = self.input_chunk_length + self.output_chunk_length
          last_idx = self.cov_time_inf_short.end_time()
  
      assert len(idx) == n_out
      assert idx[-1] == last_idx
  
      # check generated inference index without passing covariates when n > output_chunk_length
      idx, _ = ig.generate_inference_idx(
          self.n_long, self.target_time, None
      )
      if is_past:
          n_out = (
              self.input_chunk_length
              + self.n_long
              - self.output_chunk_length
          )
          last_idx = (
              self.target_time.end_time()
              + (self.n_long - self.output_chunk_length)
              * self.target_time.freq
          )
      else:
          n_out = self.input_chunk_length + self.n_long
          last_idx = self.cov_time_inf_long.end_time()
  
      assert len(idx) == n_out
      assert idx[-1] == last_idx
  
      idx, _ = ig.generate_inference_idx(
          self.n_short, self.target_time, self.cov_time_inf_short
      )
      assert idx.equals(self.cov_time_inf_short.time_index)
      idx, _ = ig.generate_inference_idx(
          self.n_long, self.target_time, self.cov_time_inf_long
      )
      assert idx.equals(self.cov_time_inf_long.time_index)
      idx, _ = ig.generate_inference_idx(
          self.n_short, self.target_int, self.cov_int_inf_short
      )
      assert idx.equals(self.cov_int_inf_short.time_index)
      idx, _ = ig.generate_inference_idx(
          self.n_long, self.target_int, self.cov_int_inf_long
      )
      assert idx.equals(self.cov_int_inf_long.time_index)
  
file_path: darts/darts/tests/dataprocessing/encoders/test_covariate_index_generators.py
imports: import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.dataprocessing.encoders.encoder_base import CovariatesIndexGenerator, FutureCovariatesIndexGenerator, PastCovariatesIndexGenerator
  from darts.logging import get_logger
  from darts.utils import timeseries_generation
label_desc: Use image node_id 3 for calling the TestCovariatesIndexGenerator obj's underlying member method code with example usage: obj.helper_test_index_generator_inference(ig, is_past) without return types