code: def test_text_dataset_from_directory_errors(self):
      directory = self._prepare_directory(num_classes=3, count=5)
  
      with self.assertRaisesRegex(
          ValueError, "`labels` argument should be"
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, labels="other"
          )
  
      with self.assertRaisesRegex(
          ValueError, "`label_mode` argument must be"
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, label_mode="other"
          )
  
      with self.assertRaisesRegex(
          ValueError, 'only pass `class_names` if `labels="inferred"`'
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory,
              labels=[0, 0, 1, 1, 1],
              class_names=["class_0", "class_1", "class_2"],
          )
  
      with self.assertRaisesRegex(
          ValueError,
          "Expected the lengths of `labels` to match the number of files",
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, labels=[0, 0, 1, 1]
          )
  
      with self.assertRaisesRegex(
          ValueError, "`class_names` passed did not match"
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, class_names=["class_0", "wrong_class"]
          )
  
      with self.assertRaisesRegex(
          ValueError, "there must be exactly 2"
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, label_mode="binary"
          )
  
      with self.assertRaisesRegex(
          ValueError, "`validation_split` must be between 0 and 1"
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, validation_split=2
          )
  
      with self.assertRaisesRegex(
          ValueError,
          '`subset` must be either "training", "validation" or "both"',
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, validation_split=0.2, subset="other"
          )
  
      with self.assertRaisesRegex(
          ValueError, "`validation_split` must be set"
      ):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, validation_split=0.0, subset="training"
          )
  
      with self.assertRaisesRegex(ValueError, "must provide a `seed`"):
          _ = text_dataset_utils.text_dataset_from_directory(
              directory, validation_split=0.2, subset="training"
          )
  
file_path: keras/keras/utils/text_dataset_utils_test.py
imports: import os
  import random
  import string
  from keras import testing
  from keras.utils import text_dataset_utils
label_desc: Use image node_id 10 for calling the TextDatasetFromDirectoryTest obj's underlying member method code with example usage: obj.test_text_dataset_from_directory_errors() without return types