code: def test_unknown_entity_should_raise_exception(self):
      # Given
      dataset = {
          "intents": {
              "intent1": {
                  "utterances": [
                      {
                          "data": [
                              {
                                  "text": "unknown entity",
                                  "entity": "unknown_entity",
                                  "slot_name": "unknown_entity_slot",
                              }
                          ]
                      }
                  ]
              }
          },
          "entities": {
              "entity1": {
                  "data": [],
                  "use_synonyms": True,
                  "automatically_extensible": False,
              }
          },
          "language": "en",
      }
  
      # When/Then
      with self.assertRaises(DatasetFormatError) as ctx:
          validate_and_format_dataset(dataset)
      self.assertEqual(
          "Expected entities to have key: 'unknown_entity'",
          str(ctx.exception.args[0]),
      )
  
imports: from __future__ import unicode_literals
  import io
  from builtins import range, str
  from future.utils import iteritems
  from mock import mock, patch
  from snips_nlu.constants import ENTITIES, SNIPS_DATETIME, VALIDATED
  from snips_nlu.dataset import Dataset
  from snips_nlu.dataset.validation import validate_and_format_dataset, _validate_and_format_custom_entity
  from snips_nlu.exceptions import DatasetFormatError
  from snips_nlu.tests.utils import SnipsTest, EntityParserMock
label_desc: Use image node_id 2 for calling the TestDatasetValidation obj's underlying member method code with example usage: obj.test_unknown_entity_should_raise_exception() without return types