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)
test if sequence encoder is initialized properly from model params
darts/tests/dataprocessing/encoders/test_encoders.py