code: def test_entity_is_extracted(
      example: Text, expected_num_entities: int
  ):
      reader = RasaYAMLReader()
  
      intent_name = "test-intent"
  
      yaml_string = f"""
  nlu:
  - intent: {intent_name}
    examples: |
      - {example}
  """
  
      result = reader.reads(yaml_string)
  
      assert len(result.training_examples) == 1
      actual_example = result.training_examples[0]
      assert actual_example.data["intent"] == intent_name
      assert (
          len(actual_example.data.get("entities", []))
          == expected_num_entities
      )
  
imports: import textwrap
  import warnings
  from typing import Text
  import pytest
  import pathlib
  from rasa.shared.exceptions import YamlException, YamlSyntaxException
  import rasa.shared.utils.io
  from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
  from rasa.shared.nlu.constants import INTENT, METADATA, METADATA_INTENT, METADATA_EXAMPLE
  from rasa.shared.nlu.training_data.formats.rasa_yaml import RasaYAMLReader, RasaYAMLWriter
  from tests.conftest import filter_expected_warnings
label_desc: Use image node_id 10 for calling a global function with example usage: test_entity_is_extracted(example, expected_num_entities) without return types