code: def test_attr_pipeline_checks(en_vocab):
      doc1 = Doc(en_vocab, words=["Test"])
      doc1[0].dep_ = "ROOT"
      doc2 = Doc(en_vocab, words=["Test"])
      doc2[0].tag_ = "TAG"
      doc2[0].pos_ = "X"
      doc2[0].set_morph("Feat=Val")
      doc2[0].lemma_ = "LEMMA"
      doc3 = Doc(en_vocab, words=["Test"])
      # DEP requires DEP
      matcher = Matcher(en_vocab)
      matcher.add("TEST", [[{"DEP": "a"}]])
      matcher(doc1)
      with pytest.raises(ValueError):
          matcher(doc2)
      with pytest.raises(ValueError):
          matcher(doc3)
      # errors can be suppressed if desired
      matcher(doc2, allow_missing=True)
      matcher(doc3, allow_missing=True)
      # TAG, POS, LEMMA require those values
      for attr in ("TAG", "POS", "LEMMA"):
          matcher = Matcher(en_vocab)
          matcher.add("TEST", [[{attr: "a"}]])
          matcher(doc2)
          with pytest.raises(ValueError):
              matcher(doc1)
          with pytest.raises(ValueError):
              matcher(doc3)
      # TEXT/ORTH only require tokens
      matcher = Matcher(en_vocab)
      matcher.add("TEST", [[{"ORTH": "a"}]])
      matcher(doc1)
      matcher(doc2)
      matcher(doc3)
      matcher = Matcher(en_vocab)
      matcher.add("TEST", [[{"TEXT": "a"}]])
      matcher(doc1)
      matcher(doc2)
      matcher(doc3)
  
imports: import pytest
  from mock import Mock
  from spacy.matcher import Matcher
  from spacy.tokens import Doc, Span, Token
  from ..doc.test_underscore import clean_underscore
label_desc: Use image node_id 40 for calling a global function with example usage: test_attr_pipeline_checks(en_vocab) without return types