code: def test_featurize_trackers_keep_action_unlikely_intent_max_history_featurizer(
      moodbot_domain: Domain,
      moodbot_features: Dict[Text, Dict[Text, Features]],
      max_history: Optional[int],
  ):
      tracker = DialogueStateTracker.from_events(
          "default",
          [
              ActionExecuted(ACTION_LISTEN_NAME),
              user_uttered("greet"),
              ActionExecuted(ACTION_UNLIKELY_INTENT_NAME),
              ActionExecuted("utter_greet"),
              ActionExecuted(ACTION_LISTEN_NAME),
              user_uttered("mood_unhappy"),
          ],
          domain=moodbot_domain,
      )
      state_featurizer = SingleStateFeaturizer()
      tracker_featurizer = MaxHistoryTrackerFeaturizer(
          state_featurizer, max_history=max_history
      )
  
      (
          actual_features,
          actual_labels,
          entity_tags,
      ) = tracker_featurizer.featurize_trackers(
          [tracker], moodbot_domain, precomputations=None
      )
  
      expected_features = [
          [{}],
          [
              {},
              {
                  ACTION_NAME: [
                      moodbot_features["actions"][ACTION_LISTEN_NAME]
                  ],
                  INTENT: [moodbot_features["intents"]["greet"]],
              },
          ],
          [
              {},
              {
                  ACTION_NAME: [
                      moodbot_features["actions"][ACTION_LISTEN_NAME]
                  ],
                  INTENT: [moodbot_features["intents"]["greet"]],
              },
              {
                  ACTION_NAME: [
                      moodbot_features["actions"][
                          ACTION_UNLIKELY_INTENT_NAME
                      ]
                  ]
              },
          ],
          [
              {},
              {
                  ACTION_NAME: [
                      moodbot_features["actions"][ACTION_LISTEN_NAME]
                  ],
                  INTENT: [moodbot_features["intents"]["greet"]],
              },
              {
                  ACTION_NAME: [
                      moodbot_features["actions"][
                          ACTION_UNLIKELY_INTENT_NAME
                      ]
                  ]
              },
              {
                  ACTION_NAME: [
                      moodbot_features["actions"]["utter_greet"]
                  ]
              },
          ],
      ]
      if max_history is not None:
          expected_features = [
              x[-max_history:] for x in expected_features
          ]
  
      assert actual_features is not None
      assert len(actual_features) == len(expected_features)
  
      for actual, expected in zip(actual_features, expected_features):
          assert compare_featurized_states(actual, expected)
  
      expected_labels = np.array([[0, 9, 17, 0]]).T
      assert actual_labels is not None
      assert actual_labels.shape == expected_labels.shape
      for actual, expected in zip(actual_labels, expected_labels):
          assert np.all(actual == expected)
  
      # moodbot doesn't contain e2e entities
      assert not any([any(turn_tags) for turn_tags in entity_tags])
  
imports: from typing import Text, Dict, List, Optional
  import numpy
  import pytest
  from rasa.core.featurizers.single_state_featurizer import SingleStateFeaturizer
  from rasa.core.featurizers.single_state_featurizer import IntentTokenizerSingleStateFeaturizer
  from rasa.core.featurizers.tracker_featurizers import TrackerFeaturizer
  from rasa.core.featurizers.tracker_featurizers import MaxHistoryTrackerFeaturizer
  from rasa.core.featurizers.tracker_featurizers import IntentMaxHistoryTrackerFeaturizer
  from rasa.core.featurizers.tracker_featurizers import FullDialogueTrackerFeaturizer
  from rasa.shared.core.domain import Domain
  from tests.core.utilities import user_uttered
  from rasa.shared.nlu.training_data.features import Features
  from rasa.shared.nlu.constants import INTENT, ACTION_NAME
  from rasa.shared.core.constants import ACTION_LISTEN_NAME, ACTION_UNLIKELY_INTENT_NAME, USER, PREVIOUS_ACTION
  from rasa.shared.core.events import ActionExecuted
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.utils.tensorflow.constants import LABEL_PAD_ID
  from rasa.utils.tensorflow.model_data import ragged_array_to_ndarray
  from rasa.core.exceptions import InvalidTrackerFeaturizerUsageError
label_desc: Use image node_id 19 for calling a global function with example usage: test_featurize_trackers_keep_action_unlikely_intent_max_history_featurizer(moodbot_domain, moodbot_features, max_history) without return types