code: def test_from_dict():
      data = {
          "type": "haystack.components.readers.extractive.ExtractiveReader",
          "init_parameters": {
              "model": "my-model",
              "device": None,
              "token": None,
              "top_k": 20,
              "score_threshold": None,
              "max_seq_length": 384,
              "stride": 128,
              "max_batch_size": None,
              "answers_per_seq": None,
              "no_answer": True,
              "calibration_factor": 0.1,
              "model_kwargs": {"torch_dtype": "torch.float16"},
          },
      }
  
      component = ExtractiveReader.from_dict(data)
      assert component.model_name_or_path == "my-model"
      assert component.token is None
      assert component.top_k == 20
      assert component.score_threshold is None
      assert component.max_seq_length == 384
      assert component.stride == 128
      assert component.max_batch_size is None
      assert component.answers_per_seq is None
      assert component.no_answer
      assert component.calibration_factor == 0.1
      # torch_dtype is correctly deserialized
      assert component.model_kwargs == {"torch_dtype": torch.float16}
  
imports: from math import ceil, exp
  from typing import List
  from unittest.mock import patch, Mock
  import pytest
  import torch
  from transformers import pipeline
  from haystack.components.readers import ExtractiveReader
  from haystack import Document, ExtractedAnswer
label_desc: Use image node_id 5 for calling a global function with example usage: test_from_dict() without return types