code: def test_replace_listeners_invalid():
      orig_config = Config().from_str(cfg_string)
      nlp = util.load_model_from_config(
          orig_config, auto_fill=True, validate=True
      )
      text = "This is awesome"
      examples = [
          Example.from_dict(
              nlp.make_doc(text), {"tags": ["A", "B", "C"]}
          )
      ]
      optimizer = nlp.initialize(lambda: examples)
      for i in range(2):
          losses = {}
          nlp.update(examples, sgd=optimizer, losses=losses)
      with pytest.raises(ValueError):
          nlp.replace_listeners("invalid", "tagger", ["model.tok2vec"])
      with pytest.raises(ValueError):
          nlp.replace_listeners(
              "transformer", "parser", ["model.tok2vec"]
          )
      with pytest.raises(ValueError):
          nlp.replace_listeners("transformer", "tagger", ["model.yolo"])
      with pytest.raises(ValueError):
          nlp.replace_listeners(
              "transformer", "tagger", ["model.tok2vec", "model.yolo"]
          )
  
imports: import pytest
  from packaging.version import Version
  import torch
  import spacy
  from spacy.language import Language
  from spacy.training.example import Example
  from spacy.util import make_tempdir
  from spacy.vocab import Vocab
  from spacy.tokens import Doc
  from spacy import util
  from thinc.api import Model, Config, get_current_ops, NumpyOps
  from spacy.tests.util import assert_docs_equal
  from .util import DummyTransformer, _assert_equal_tensors
  from ..None import TransformerModel
  from ..pipeline_component import Transformer
  from ..layers import TransformerListener
  from ..data_classes import TransformerData, FullTransformerBatch
label_desc: Use image node_id 17 for calling a global function with example usage: test_replace_listeners_invalid() without return types