code: def test_keep_relevant_docspans():
      _DocSpan = collections.namedtuple("DocSpan", ["start", "length"])
  
      doc_spans = [
          _DocSpan(start=start, length=5) for start in range(15)
      ]
  
      tok_start_position = 1
      tok_end_position = 2
  
      mode = "all"
      assert doc_spans == SquadDataset.keep_relevant_docspans(
          doc_spans, tok_start_position, tok_end_position, mode
      )
  
      doc_spans = [
          _DocSpan(start=start, length=5) for start in range(15)
      ]
  
      tok_start_position = -1
      tok_end_position = -1
  
      mode = "only_positive"
  
      expected_doc_spans = []
      assert expected_doc_spans == SquadDataset.keep_relevant_docspans(
          doc_spans, tok_start_position, tok_end_position, mode
      )
  
      doc_spans = [
          _DocSpan(start=start, length=5) for start in range(15)
      ]
  
      tok_start_position = 1
      tok_end_position = 2
  
      mode = "only_positive"
  
      expected_doc_spans = [
          _DocSpan(start=0, length=5),
          _DocSpan(start=1, length=5),
      ]
      assert expected_doc_spans == SquadDataset.keep_relevant_docspans(
          doc_spans, tok_start_position, tok_end_position, mode
      )
  
      doc_spans = [
          _DocSpan(start=start, length=5) for start in range(15)
      ]
  
      tok_start_position = 1
      tok_end_position = 2
  
      mode = "limited_negative"
  
      expected_doc_spans = [
          _DocSpan(start=start, length=5) for start in range(10)
      ]
      assert expected_doc_spans == SquadDataset.keep_relevant_docspans(
          doc_spans, tok_start_position, tok_end_position, mode
      )
  
file_path: NeMo/tests/collections/nlp/test_question_answering.py
imports: import collections
  from pydoc import doc
  import pytest
  from nemo.collections.nlp.data.question_answering_squad.qa_dataset import SquadDataset
  from nemo.collections.nlp.data.question_answering_squad.qa_squad_processing import _get_tokens, exact_match_score, f1_score
label_desc: Use image node_id 7 for calling a global function with example usage: test_keep_relevant_docspans() without return types