code: def test_wrong_keys_and_types(tmpdir):
      TEST_CSV_DATA.pop("answer_text")
      with pytest.raises(KeyError):
          csv_path = csv_data(tmpdir)
          QuestionAnsweringData.from_csv(
              question_column_name="question",
              context_column_name="context",
              answer_column_name="answer",
              train_file=csv_path,
              batch_size=2,
          )
  
      TEST_CSV_DATA.pop("answer_start")
      with pytest.raises(KeyError):
          csv_path = csv_data(tmpdir)
          QuestionAnsweringData.from_csv(
              question_column_name="question",
              context_column_name="context",
              answer_column_name="answer",
              train_file=csv_path,
              batch_size=2,
          )
  
      TEST_JSON_DATA = [
          {
              "id": "12345",
              "context": "this is an answer one. this is a context one",
              "question": "this is a question one",
          },
          {
              "id": "12346",
              "context": "this is an answer two. this is a context two",
              "question": "this is a question two",
          },
      ]
  
      with pytest.raises(KeyError):
          json_path = json_data(tmpdir, TEST_JSON_DATA)
          QuestionAnsweringData.from_json(
              question_column_name="question",
              context_column_name="context",
              answer_column_name="answer",
              train_file=json_path,
              batch_size=2,
          )
  
      TEST_JSON_DATA[0]["answer"] = "this is an answer one"
      TEST_JSON_DATA[1]["answer"] = "this is an answer two"
      with pytest.raises(TypeError):
          json_path = json_data(tmpdir, TEST_JSON_DATA)
          QuestionAnsweringData.from_json(
              question_column_name="question",
              context_column_name="context",
              answer_column_name="answer",
              train_file=json_path,
              batch_size=2,
          )
  
file_path: lightning-flash/tests/text/question_answering/test_data.py
imports: import json
  import os
  from pathlib import Path
  import pandas
  import pytest
  from flash.core.utilities.imports import _TOPIC_TEXT_AVAILABLE
  from flash.text import QuestionAnsweringData
label_desc: Use image node_id 9 for calling a global function with example usage: test_wrong_keys_and_types(tmpdir) without return types