code: def test_matches_hf_pipeline():
      reader = ExtractiveReader(
          "deepset/tinyroberta-squad2",
          device="cpu",
          overlap_threshold=None,
      )
      reader.warm_up()
      answers = reader.run(
          example_queries[0],
          [[example_documents[0][0]]][0],
          top_k=20,
          no_answer=False,
      )[
          "answers"
      ]  # [0] Remove first two indices when batching support is reintroduced
      pipe = pipeline(
          "question-answering",
          model=reader.model,
          tokenizer=reader.tokenizer,
          align_to_words=False,
      )
      answers_hf = pipe(
          question=example_queries[0],
          context=example_documents[0][0].content,
          max_answer_len=1_000,
          handle_impossible_answer=False,
          top_k=20,
      )  # We need to disable HF postprocessing features to make the results comparable. This is related to https://github.com/huggingface/transformers/issues/26286
      assert len(answers) == len(answers_hf) == 20
      for answer, answer_hf in zip(answers, answers_hf):
          assert answer.document_offset.start == answer_hf["start"]
          assert answer.document_offset.end == answer_hf["end"]
          assert answer.data == answer_hf["answer"]
  
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 15 for calling a global function with example usage: test_matches_hf_pipeline() without return types