code: def test_named_entity_extractor_backend():
      _ = NamedEntityExtractor(
          backend=NamedEntityExtractorBackend.HUGGING_FACE,
          model="dslim/bert-base-NER",
      )
  
      _ = NamedEntityExtractor(
          backend="hugging_face", model="dslim/bert-base-NER"
      )
  
      _ = NamedEntityExtractor(
          backend=NamedEntityExtractorBackend.SPACY,
          model="en_core_web_sm",
      )
  
      _ = NamedEntityExtractor(backend="spacy", model="en_core_web_sm")
  
      with pytest.raises(ComponentError, match=r"Invalid backend"):
          NamedEntityExtractor(
              backend="random_backend", model="dslim/bert-base-NER"
          )
  
imports: import pytest
  from haystack import ComponentError, DeserializationError
  from haystack.components.extractors import NamedEntityExtractor, NamedEntityExtractorBackend
label_desc: Use image node_id 1 for calling a global function with example usage: test_named_entity_extractor_backend() without return types