code: def test_default_component_from_dict():
      def custom_init(self, some_param):
          self.some_param = some_param
  
      extra_fields = {"__init__": custom_init}
      MyComponent = factory.component_class(
          "MyComponent", extra_fields=extra_fields
      )
      comp = default_from_dict(
          MyComponent,
          {
              "type": "haystack.testing.factory.MyComponent",
              "init_parameters": {"some_param": 10},
          },
      )
      assert isinstance(comp, MyComponent)
      assert comp.some_param == 10
  
file_path: haystack/test/core/test_serialization.py
imports: import sys
  from unittest.mock import Mock
  import pytest
  from haystack.core.pipeline import Pipeline
  from haystack.core.component import component
  from haystack.core.errors import DeserializationError
  from haystack.testing import factory
  from haystack.core.serialization import default_to_dict, default_from_dict
label_desc: Use image node_id 3 for calling a global function with example usage: test_default_component_from_dict() without return types