code: def test_train_with_e2e_data(
      default_model_storage: ModelStorage,
      default_execution_context: ExecutionContext,
      tracker_events: List[List[Event]],
      skip_training: bool,
      domain: Domain,
  ):
      policy = UnexpecTEDIntentPolicy(
          UnexpecTEDIntentPolicy.get_default_config(),
          default_model_storage,
          Resource("UnexpecTEDIntentPolicy"),
          default_execution_context,
          featurizer=IntentMaxHistoryTrackerFeaturizer(
              IntentTokenizerSingleStateFeaturizer()
          ),
      )
      trackers_for_training = [
          TrackerWithCachedStates.from_events(
              sender_id=f"{tracker_index}", evts=events, domain=domain
          )
          for tracker_index, events in enumerate(tracker_events)
      ]
      if skip_training:
          with pytest.warns(UserWarning):
              policy.train(
                  trackers_for_training, domain, precomputations=None
              )
      else:
          policy.train(
              trackers_for_training, domain, precomputations=None
          )
  
imports: import json
  from pathlib import Path
  from typing import Optional, List, Dict, Type
  import tensorflow
  import numpy
  import pytest
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.logging import LogCaptureFixture
  import logging
  from rasa.core.featurizers.single_state_featurizer import IntentTokenizerSingleStateFeaturizer
  from rasa.core.featurizers.tracker_featurizers import TrackerFeaturizer
  from rasa.core.featurizers.tracker_featurizers import IntentMaxHistoryTrackerFeaturizer
  from rasa.nlu.classifiers import LABEL_RANKING_LENGTH
  from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
  from rasa.shared.core.generator import TrackerWithCachedStates
  from rasa.core.policies.ted_policy import PREDICTION_FEATURES
  from rasa.core.policies.unexpected_intent_policy import UnexpecTEDIntentPolicy, RankingCandidateMetadata
  from rasa.engine.graph import ExecutionContext
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.shared.core.constants import ACTION_UNLIKELY_INTENT_NAME, ACTION_LISTEN_NAME
  from rasa.shared.core.domain import Domain
  from rasa.shared.core.events import ActionExecuted, UserUttered, EntitiesAdded, SlotSet, ActionExecutionRejected, ActiveLoop
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.utils.tensorflow.constants import IGNORE_INTENTS_LIST, LABEL, MASK, SENTENCE, IDS, POSITIVE_SCORES_KEY, NEGATIVE_SCORES_KEY, RANKING_KEY, RANKING_LENGTH
  from rasa.shared.nlu.constants import INTENT
  from rasa.shared.core.events import Event
  from rasa.utils.tensorflow import model_data_utils
  from tests.core.test_policies import train_trackers
  from tests.core.policies.test_ted_policy import TestTEDPolicy
label_desc: Use image node_id 1 for calling a global function with example usage: test_train_with_e2e_data(default_model_storage, default_execution_context, tracker_events, skip_training, domain) without return types