class_docstr: Tests the `create_lagged_training_data` function defined in `darts.utils.data.tabularization`. There are broadly
  two 'groups' of tests defined in this module:
      1. 'Generated Test Cases': these test that `create_lagged_training_data` produces the same outputs
      as a simplified implementation of the 'time intersection' feature generation method (see
      `darts.utils.data.tabularization` for further details). For these tests, the 'correct answer' is not
      directly specified; instead, it is generated from a set of input parameters using the set of simplified
      functions. The rationale behind this approach is that it allows for many different combinations of input
      values to be effortlessly tested. The drawback of this, however, is that the correctness of these tests
      assumes that the simplified functions have been implemented correctly - if this isn't the case, then these
      tests are not to be trusted. In saying this, these simplified functions are significantly easier to
      understand and debug than the `create_lagged_training_data` function they're helping to test.
      2. 'Specified Test Cases': these test that `create_lagged_training_data` returns an exactly specified
      output; these specified outputs are *not* 'generated' by another function. Although these 'specified'
      test cases tend to be simpler and less extensive than the 'generated' test cases, their correctness does
      not assume the correct implementation of any other function.
class_docstr_tok: ["Tests","the","`","create_lagged_training_data","`","function","defined","in","`","darts.utils.data.tabularization","`",".","There","are","broadly","two","'groups","'","of","tests","defined","in","this","module",":","1",".","'Generated","Test","Cases","'",":","these","test","that","`","create_lagged_training_data","`","produces","the","same","outputs","as","a","simplified","implementation","of","the","'time","intersection","'","feature","generation","method","(","see","`","darts.utils.data.tabularization","`","for","further","details",")",".","For","these","tests",",","the","'correct","answer","'","is","not","directly","specified",";","instead",",","it","is","generated","from","a","set","of","input","parameters","using","the","set","of","simplified","functions",".","The","rationale","behind","this","approach","is","that","it","allows","for","many","different","combinations","of","input","values","to","be","effortlessly","tested",".","The","drawback","of","this",",","however",",","is","that","the","correctness","of","these","tests","assumes","that","the","simplified","functions","have","been","implemented","correctly","-","if","this","is","n't","the","case",",","then","these","tests","are","not","to","be","trusted",".","In","saying","this",",","these","simplified","functions","are","significantly","easier","to","understand","and","debug","than","the","`","create_lagged_training_data","`","function","they","'re","helping","to","test",".","2",".","'Specified","Test","Cases","'",":","these","test","that","`","create_lagged_training_data","`","returns","an","exactly","specified","output",";","these","specified","outputs","are","*","not","*","'generated","'","by","another","function",".","Although","these","'specified'","test","cases","tend","to","be","simpler","and","less","extensive","than","the","'generated","'","test","cases",",","their","correctness","does","not","assume","the","correct","implementation","of","any","other","function","."]
docstr: Tests that `create_lagged_training_data` correctly handles case where features
  and labels can be created for a time that is *not* contained in `past_covariates`
  and/or `future_covariates`. This particular test checks this behaviour by using
  range index timeseries.
  
  More specifically, we define the series and lags such that a training example can
  be generated for time `target.end_time()`, even though this time isn't contained in
  neither `past` nor `future`.
docstr_tok: ["Tests","that","`","create_lagged_training_data","`","correctly","handles","case","where","features","and","labels","can","be","created","for","a","time","that","is","*","not","*","contained","in","`","past_covariates","`","and\/or","`","future_covariates","`",".","This","particular","test","checks","this","behaviour","by","using","range","index","timeseries",".","More","specifically",",","we","define","the","series","and","lags","such","that","a","training","example","can","be","generated","for","time","`","target.end_time","(",")","`",",","even","though","this","time","is","n't","contained","in","neither","`","past","`","nor","`","future","`","."]
code: def test_lagged_training_data_extend_past_and_future_covariates_range_idx(
      self,
  ):
      """
      Tests that `create_lagged_training_data` correctly handles case where features
      and labels can be created for a time that is *not* contained in `past_covariates`
      and/or `future_covariates`. This particular test checks this behaviour by using
      range index timeseries.
  
      More specifically, we define the series and lags such that a training example can
      be generated for time `target.end_time()`, even though this time isn't contained in
      neither `past` nor `future`.
      """
      # Can create feature for time `t = 10`, but this time isn't in `past` or `future`:
      target = linear_timeseries(
          start=0, end=10, start_value=1, end_value=2
      )
      lags = [-1]
      past = linear_timeseries(
          start=0, end=8, start_value=2, end_value=3
      )
      lags_past = [-2]
      future = linear_timeseries(
          start=0, end=6, start_value=3, end_value=4
      )
      lags_future = [-4]
      # Only want to check very last generated observation:
      max_samples_per_ts = 1
      # Expect `X` to be constructed from second-to-last value of `target` (i.e.
      # the value immediately prior to the label), and the very last values of
      # `past` and `future`:
      expected_X = np.concatenate(
          [
              target.all_values(copy=False)[-2, :, 0],
              past.all_values(copy=False)[-1, :, 0],
              future.all_values(copy=False)[-1, :, 0],
          ]
      ).reshape(1, -1)
      # Label is very last value of `target`:
      expected_y = target.all_values(copy=False)[-1, :, 0]
      # Check correctness for both 'moving window' method
      # and 'time intersection' method:
      for use_moving_windows in (False, True):
          X, y, times, _ = create_lagged_training_data(
              target,
              output_chunk_length=1,
              past_covariates=past,
              future_covariates=future,
              lags=lags,
              lags_past_covariates=lags_past,
              lags_future_covariates=lags_future,
              uses_static_covariates=False,
              max_samples_per_ts=max_samples_per_ts,
              use_moving_windows=use_moving_windows,
          )
          assert times[0][0] == target.end_time()
          assert np.allclose(expected_X, X[:, :, 0])
          assert np.allclose(expected_y, y[:, :, 0])
  
imports: import warnings
  from itertools import product
  from typing import Optional, Sequence
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts import concatenate
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from darts.utils.data.tabularization import create_lagged_component_names, create_lagged_training_data
  from darts.utils.timeseries_generation import linear_timeseries
label_desc: Use image node_id 16 for calling the TestCreateLaggedTrainingData obj's underlying member method code with example usage: obj.test_lagged_training_data_extend_past_and_future_covariates_range_idx() without return types