code: def test_text_infill_with_collapse_mask_token():
      """Tests for different text infilling output combinations with collapsing mask token."""
  
      AutoTokenizer = pytest.importorskip("transformers").AutoTokenizer
  
      tokenizer = AutoTokenizer.from_pretrained("gpt2")
      masker = shap.maskers.Text(
          tokenizer, mask_token="...", collapse_mask_token=True
      )
  
      s = "This is a test string to be infilled"
  
      # s_masked_with_infill_ex1 = "This is a test string ... ... ..."
      mask_ex1 = np.array(
          [True, True, True, True, True, False, False, False, False]
      )
      # s_masked_with_infill_ex2 = "This is a ... ... to be infilled"
      mask_ex2 = np.array(
          [True, True, True, False, False, True, True, True, True]
      )
      # s_masked_with_infill_ex3 = "... ... ... test string to be infilled"
      mask_ex3 = np.array(
          [False, False, False, True, True, True, True, True, True]
      )
      # s_masked_with_infill_ex4 = "... ... ... ... ... ... ... ..."
      mask_ex4 = np.array(
          [
              False,
              False,
              False,
              False,
              False,
              False,
              False,
              False,
              False,
          ]
      )
  
      text_infilled_ex1 = masker(mask_ex1, s)[0][0]
      expected_text_infilled_ex1 = "This is a test string ..."
  
      text_infilled_ex2 = masker(mask_ex2, s)[0][0]
      expected_text_infilled_ex2 = "This is a ... to be infilled"
  
      text_infilled_ex3 = masker(mask_ex3, s)[0][0]
      expected_text_infilled_ex3 = "... test string to be infilled"
  
      text_infilled_ex4 = masker(mask_ex4, s)[0][0]
      expected_text_infilled_ex4 = "..."
  
      assert (
          text_infilled_ex1 == expected_text_infilled_ex1
          and text_infilled_ex2 == expected_text_infilled_ex2
          and text_infilled_ex3 == expected_text_infilled_ex3
          and text_infilled_ex4 == expected_text_infilled_ex4
      )
  
file_path: shap/tests/maskers/test_text.py
imports: import tempfile
  import numpy
  import pytest
  import shap
label_desc: Use image node_id 7 for calling a global function with example usage: test_text_infill_with_collapse_mask_token() without return types