code: def test_invalid_module_error_when_deserializing_schemas(
      tmp_path: Path,
  ):
      graph_schema = GraphSchema(
          {
              "train": SchemaNode(
                  needs={},
                  uses=PersistableTestComponent,
                  fn="train",
                  constructor_name="create",
                  config={
                      "some_config": 123455,
                      "some more config": [{"nested": "hi"}],
                  },
              )
          }
      )
  
      serialized = graph_schema.as_dict()
  
      # Pretend module is for some reason invalid
      serialized["nodes"]["train"]["uses"] = "invalid.class"
  
      # Dump it to make sure it's actually serializable
      file_path = tmp_path / "my_graph.yml"
      rasa.shared.utils.io.write_yaml(serialized, file_path)
  
      serialized_graph_schema_from_file = (
          rasa.shared.utils.io.read_yaml_file(file_path)
      )
  
      with pytest.raises(GraphSchemaException):
          _ = GraphSchema.from_dict(serialized_graph_schema_from_file)
  
file_path: rasa/tests/engine/test_graph.py
imports: from __future__ import annotations
  from pathlib import Path
  from typing import Dict, Text
  import pytest
  from rasa.engine.storage.resource import Resource
  import rasa.shared.utils.io
  from rasa.engine.exceptions import GraphSchemaException
  from rasa.engine.graph import SchemaNode, GraphSchema
  from tests.engine.graph_components_test_classes import PersistableTestComponent
label_desc: Use image node_id 2 for calling a global function with example usage: test_invalid_module_error_when_deserializing_schemas(tmp_path) without return types