code: def test_container_add_fails_if_messages_are_different_but_have_same_key():
      # construct a set of unique substates
      dummy_value = "this-could-be-anything"
      substates_with_unique_key_attribute = [
          {INTENT: "greet"},
          {TEXT: "text", ENTITIES: dummy_value},
          {ACTION_TEXT: "action_text"},
          {ACTION_NAME: "action_name"},
      ]
      constant_feature = _dummy_features(id=1, attribute="arbitrary")
      different_feature = _dummy_features(id=1, attribute="arbitrary")
      # adding the unique messages works fine of course,...
      lookup_table = MessageContainerForCoreFeaturization()
      for sub_state in substates_with_unique_key_attribute:
          lookup_table.add(
              Message(data=sub_state, features=[constant_feature])
          )
      # ... but adding any substate with same key but different content doesn't
      new_key = "some-new-key"
      expected_error_message = "Expected added message to be consistent"
      for sub_state in substates_with_unique_key_attribute:
          # with extra attribute
          sub_state_with_extra_attribute = sub_state.copy()
          sub_state_with_extra_attribute[
              new_key
          ] = "some-value-for-the-new-key"
          with pytest.raises(ValueError, match=expected_error_message):
              lookup_table.add(
                  Message(data=sub_state_with_extra_attribute)
              )
          # with new feature
          with pytest.raises(ValueError, match=expected_error_message):
              lookup_table.add(
                  Message(
                      data=sub_state,
                      features=[constant_feature, different_feature],
                  )
              )
          # without features
          with pytest.raises(ValueError, match=expected_error_message):
              lookup_table.add(Message(data=sub_state))
  
imports: import pytest
  import numpy
  import itertools
  from typing import List, Text, Optional, Dict
  from rasa.engine.graph import ExecutionContext
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.core.featurizers.precomputation import CoreFeaturizationCollector, MessageContainerForCoreFeaturization, CoreFeaturizationInputConverter
  from rasa.shared.nlu.training_data.features import Features
  from rasa.shared.nlu.training_data.message import Message
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.constants import INTENT, TEXT, ENTITIES, ACTION_NAME, ACTION_TEXT, INTENT_NAME_KEY, ENTITY_ATTRIBUTE_VALUE, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_ROLE, ENTITY_ATTRIBUTE_GROUP
  from rasa.shared.core.slots import TextSlot
  from rasa.shared.core.domain import Domain
  from rasa.shared.core.events import Event, UserUttered, ActionExecuted
  from rasa.shared.core.training_data.structures import StoryGraph, StoryStep
  from rasa.shared.core.trackers import DialogueStateTracker
label_desc: Use image node_id 11 for calling a global function with example usage: test_container_add_fails_if_messages_are_different_but_have_same_key() without return types