text: from unittest import TestCase
  
  from presidio_analyzer import EntityRecognizer
  
  LANGUAGE = "en"
  
  
  class TestEntityRecognizer(TestCase):
  
      def test_to_dict_correct_dictionary(self):
          ent_recognizer = EntityRecognizer(["ENTITY"])
          entity_rec_dict = ent_recognizer.to_dict()
          
          assert entity_rec_dict is not None
          assert entity_rec_dict['supported_entities'] == ['ENTITY']
          assert entity_rec_dict['supported_language'] == 'en'
  
      def test_from_dict_returns_instance(self):
          ent_rec_dict = {"supported_entities": ["A", "B", "C"],
                          "supported_language": "he"
                          }
          entity_rec = EntityRecognizer.from_dict(ent_rec_dict)
  
          assert entity_rec.supported_entities == ["A", "B", "C"]
          assert entity_rec.supported_language == "he"
          assert entity_rec.version == "0.0.1"
  
      def test_index_finding(self):
          # This test uses a simulated recognize result for the following
          # text: "my phone number is:(425) 882-9090"
          match = "(425) 882-9090"
          # the start index of the match
          start = 19
          tokens = ['my', 'phone', 'number', 'is:(425', ')', '882', '-', '9090']
          tokens_indices = [0, 3, 9, 16, 23, 25, 28, 29]
          index = EntityRecognizer.find_index_of_match_token(match, start, tokens, tokens_indices)
          assert index == 3
  