code: def test_dataframe_iterator_class_mode_categorical_multi_label(
      all_test_images, tmpdir
  ):
      # save the images in the paths
      filenames = []
      count = 0
      for test_images in all_test_images:
          for im in test_images:
              filename = "image-{}.png".format(count)
              im.save(str(tmpdir / filename))
              filenames.append(filename)
              count += 1
      label_opt = ["a", "b", ["a"], ["b"], ["a", "b"], ["b", "a"]]
      df = pd.DataFrame(
          {
              "filename": filenames,
              "class": [
                  random.choice(label_opt) for _ in filenames[:-2]
              ]
              + ["b", "a"],
          }
      )
      generator = image_data_generator.ImageDataGenerator()
      df_iterator = generator.flow_from_dataframe(df, str(tmpdir))
      batch_x, batch_y = next(df_iterator)
      assert isinstance(batch_x, np.ndarray)
      assert len(batch_x.shape) == 4
      assert isinstance(batch_y, np.ndarray)
      assert batch_y.shape == (len(batch_x), 2)
      for labels in batch_y:
          assert all(label in {0, 1} for label in labels)
  
      # on first 3 batches
      df = pd.DataFrame(
          {
              "filename": filenames,
              "class": [["b", "a"]]
              + ["b"]
              + [["c"]]
              + [random.choice(label_opt) for _ in filenames[:-3]],
          }
      )
      generator = image_data_generator.ImageDataGenerator()
      df_iterator = generator.flow_from_dataframe(
          df, str(tmpdir), shuffle=False
      )
      batch_x, batch_y = next(df_iterator)
      assert isinstance(batch_x, np.ndarray)
      assert len(batch_x.shape) == 4
      assert isinstance(batch_y, np.ndarray)
      assert batch_y.shape == (len(batch_x), 3)
      for labels in batch_y:
          assert all(label in {0, 1} for label in labels)
      assert (batch_y[0] == np.array([1, 1, 0])).all()
      assert (batch_y[1] == np.array([0, 1, 0])).all()
      assert (batch_y[2] == np.array([0, 0, 1])).all()
  
imports: import os
  import random
  import shutil
  import numpy
  import pandas
  import pytest
  from PIL import Image
  from keras_preprocessing.image import dataframe_iterator, image_data_generator
label_desc: Use image node_id 6 for calling a global function with example usage: test_dataframe_iterator_class_mode_categorical_multi_label(all_test_images, tmpdir) without return types