code: def test_lemmatizer_init(nlp):
      lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "lookup"})
      assert isinstance(lemmatizer.lookups, Lookups)
      assert not lemmatizer.lookups.tables
      assert lemmatizer.mode == "lookup"
      with pytest.raises(ValueError):
          nlp("test")
      nlp.initialize()
      assert lemmatizer.lookups.tables
      assert nlp("cope")[0].lemma_ == "cope"
      assert nlp("coped")[0].lemma_ == "cope"
      # replace any tables from spacy-lookups-data
      lemmatizer.lookups = Lookups()
      # lookup with no tables sets text as lemma
      assert nlp("cope")[0].lemma_ == "cope"
      assert nlp("coped")[0].lemma_ == "coped"
      nlp.remove_pipe("lemmatizer")
      lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "lookup"})
      with pytest.raises(ValueError):
          # Can't initialize without required tables
          lemmatizer.initialize(lookups=Lookups())
      lookups = Lookups()
      lookups.add_table("lemma_lookup", {})
      lemmatizer.initialize(lookups=lookups)
  
file_path: spacy/spacy/tests/pipeline/test_lemmatizer.py
imports: import pickle
  import pytest
  from spacy import registry, util
  from spacy.lang.en import English
  from spacy.lookups import Lookups
  from ..util import make_tempdir
label_desc: Use image node_id 2 for calling a global function with example usage: test_lemmatizer_init(nlp) without return types