code: def test_text_dataset_from_directory_binary(self):
      directory = self._prepare_directory(num_classes=2)
      dataset = text_dataset_utils.text_dataset_from_directory(
          directory, batch_size=8, label_mode="int", max_length=10
      )
      batch = next(iter(dataset))
      self.assertLen(batch, 2)
      self.assertEqual(batch[0].shape, (8,))
      self.assertEqual(batch[0].dtype.name, "string")
      self.assertEqual(len(batch[0].numpy()[0]), 10)  # Test max_length
      self.assertEqual(batch[1].shape, (8,))
      self.assertEqual(batch[1].dtype.name, "int32")
  
      dataset = text_dataset_utils.text_dataset_from_directory(
          directory, batch_size=8, label_mode="binary"
      )
      batch = next(iter(dataset))
      self.assertLen(batch, 2)
      self.assertEqual(batch[0].shape, (8,))
      self.assertEqual(batch[0].dtype.name, "string")
      self.assertEqual(batch[1].shape, (8, 1))
      self.assertEqual(batch[1].dtype.name, "float32")
  
      dataset = text_dataset_utils.text_dataset_from_directory(
          directory, batch_size=8, label_mode="categorical"
      )
      batch = next(iter(dataset))
      self.assertLen(batch, 2)
      self.assertEqual(batch[0].shape, (8,))
      self.assertEqual(batch[0].dtype.name, "string")
      self.assertEqual(batch[1].shape, (8, 2))
      self.assertEqual(batch[1].dtype.name, "float32")
  
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 3 for calling the TextDatasetFromDirectoryTest obj's underlying member method code with example usage: obj.test_text_dataset_from_directory_binary() without return types