code: def test_audio_dataset_from_directory_errors(self):
      directory = self._prepare_directory(num_classes=3, count=5)
  
      with self.assertRaisesRegex(
          ValueError,
          "`sampling_rate` should be higher than 0. Received:",
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory,
              ragged=False,
              output_sequence_length=10,
              sampling_rate=-1,
          )
  
      with self.assertRaisesRegex(
          ValueError,
          "`sampling_rate` should have an integer value. Received:",
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory,
              ragged=False,
              output_sequence_length=10,
              sampling_rate=1.2,
          )
  
      # Only run this test case when we don't have tensorflow_io.
      try:
          import tensorflow_io  # noqa: F401
      except ImportError:
          with self.assertRaisesRegex(
              ImportError,
              "To use the argument `sampling_rate`.*tensorflow_io.*",
          ):
              _ = audio_dataset_utils.audio_dataset_from_directory(
                  directory,
                  ragged=False,
                  output_sequence_length=10,
                  sampling_rate=44100,
              )
  
      with self.assertRaisesRegex(
          ValueError,
          "Cannot set both `ragged` and `output_sequence_length`",
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, ragged=True, output_sequence_length=30
          )
  
      with self.assertRaisesRegex(
          ValueError, "`labels` argument should be"
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, labels="other"
          )
  
      with self.assertRaisesRegex(
          ValueError, "`label_mode` argument must be"
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, label_mode="other"
          )
  
      with self.assertRaisesRegex(
          ValueError, 'only pass `class_names` if `labels="inferred"`'
      ):
          _ = audio_dataset_utils.audio_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",
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, labels=[0, 0, 1, 1]
          )
  
      with self.assertRaisesRegex(
          ValueError, "`class_names` passed did not match"
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, class_names=["class_0", "wrong_class"]
          )
  
      with self.assertRaisesRegex(
          ValueError, "there must be exactly 2"
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, label_mode="binary"
          )
  
      with self.assertRaisesRegex(
          ValueError, "`validation_split` must be between 0 and 1"
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, validation_split=2
          )
  
      with self.assertRaisesRegex(
          ValueError, '`subset` must be either "training",'
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, validation_split=0.2, subset="other"
          )
  
      with self.assertRaisesRegex(
          ValueError, "`validation_split` must be set"
      ):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, validation_split=0.0, subset="training"
          )
  
      with self.assertRaisesRegex(ValueError, "must provide a `seed`"):
          _ = audio_dataset_utils.audio_dataset_from_directory(
              directory, validation_split=0.2, subset="training"
          )
  
imports: import os
  import numpy
  from keras import testing
  from keras.utils import audio_dataset_utils
  from keras.utils.module_utils import tensorflow
label_desc: Use image node_id 15 for calling the AudioDatasetFromDirectoryTest obj's underlying member method code with example usage: obj.test_audio_dataset_from_directory_errors() without return types