docstr: test if sequence encoder is initialized properly from model params
docstr_tok: ["test","if","sequence","encoder","is","initialized","properly","from","model","params"]
code: def test_sequence_encoder_from_model_params(self):
      """test if sequence encoder is initialized properly from model params"""
      # valid encoder model parameters are ('past', 'future') for the main key and datetime attribute for sub keys
      valid_encoder_args = {
          "cyclic": {
              "past": ["month"],
              "future": ["dayofyear", "dayofweek"],
          }
      }
      encoders = self.helper_encoder_from_model(
          add_encoder_dict=valid_encoder_args
      )
  
      assert len(encoders.past_encoders) == 1
      assert len(encoders.future_encoders) == 2
  
      # test if encoders have the correct attributes
      assert encoders.past_encoders[0].attribute == "month"
      assert [enc.attribute for enc in encoders.future_encoders] == [
          "dayofyear",
          "dayofweek",
      ]
  
      valid_encoder_args = {"cyclic": {"past": ["month"]}}
      encoders = self.helper_encoder_from_model(
          add_encoder_dict=valid_encoder_args
      )
      assert len(encoders.past_encoders) == 1
      assert len(encoders.future_encoders) == 0
  
      # test invalid encoder kwargs at model creation
      bad_encoder = {"no_encoder": {"past": ["month"]}}
      with pytest.raises(ValueError):
          _ = self.helper_encoder_from_model(
              add_encoder_dict=bad_encoder
          )
  
      bad_time = {"cyclic": {"ppast": ["month"]}}
      with pytest.raises(ValueError):
          _ = self.helper_encoder_from_model(add_encoder_dict=bad_time)
  
      bad_attribute = {"cyclic": {"past": ["year"]}}
      with pytest.raises(ValueError):
          _ = self.helper_encoder_from_model(
              add_encoder_dict=bad_attribute
          )
  
      bad_type = {"cyclic": {"past": 1}}
      with pytest.raises(ValueError):
          _ = self.helper_encoder_from_model(add_encoder_dict=bad_type)
  
      bad_callable = {"custom": {"past": [lambda idx: idx.month]}}
      with pytest.raises(ValueError):
          _ = self.helper_encoder_from_model(
              add_encoder_dict=bad_callable
          )
  
imports: import copy
  from typing import Optional, Sequence
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.dataprocessing.encoders import FutureCallableIndexEncoder, FutureCyclicEncoder, FutureDatetimeAttributeEncoder, FutureIntegerIndexEncoder, PastCallableIndexEncoder, PastCyclicEncoder, PastDatetimeAttributeEncoder, PastIntegerIndexEncoder, SequentialEncoder
  from darts.dataprocessing.encoders.encoder_base import PastCovariatesIndexGenerator, SingleEncoder
  from darts.dataprocessing.encoders.encoders import CallableIndexEncoder, CyclicTemporalEncoder, DatetimeAttributeEncoder, IntegerIndexEncoder
  from darts.dataprocessing.transformers import Scaler
  from darts.logging import get_logger, raise_log
  from darts.utils import timeseries_generation
label_desc: Use image node_id 1 for calling the TestEncoder obj's underlying member method code with example usage: obj.test_sequence_encoder_from_model_params() without return types