code: def test_issue2833(en_vocab):
      """Test that a custom error is raised if a token or span is pickled."""
      doc = Doc(en_vocab, words=["Hello", "world"])
      with pytest.raises(NotImplementedError):
          pickle.dumps(doc[0])
      with pytest.raises(NotImplementedError):
          pickle.dumps(doc[0:2])
  
file_path: spaCy/spacy/tests/serialize/test_serialize_tokenizer.py
imports: import pickle
  import re
  import pytest
  from spacy.attrs import ENT_IOB, ENT_TYPE
  from spacy.lang.en import English
  from spacy.tokenizer import Tokenizer
  from spacy.tokens import Doc
  from spacy.util import compile_infix_regex, compile_prefix_regex, compile_suffix_regex, get_lang_class, load_model
  from ..util import assert_packed_msg_equal, make_tempdir
label_desc: Use image node_id 2 for calling a global function with example usage: test_issue2833(en_vocab) without return types