code: def test_dataframe_iterator_class_mode_multi_output(
      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
      # fit both outputs are a single number
      df = pd.DataFrame({"filename": filenames}).assign(
          output_0=np.random.uniform(size=len(filenames)),
          output_1=np.random.uniform(size=len(filenames)),
      )
      df_iterator = (
          image_data_generator.ImageDataGenerator().flow_from_dataframe(
              df,
              y_col=["output_0", "output_1"],
              directory=str(tmpdir),
              batch_size=3,
              shuffle=False,
              class_mode="multi_output",
          )
      )
      batch_x, batch_y = next(df_iterator)
      assert isinstance(batch_x, np.ndarray)
      assert len(batch_x.shape) == 4
      assert isinstance(batch_y, list)
      assert len(batch_y) == 2
      assert np.array_equal(
          batch_y[0], np.array(df["output_0"].tolist()[:3])
      )
      assert np.array_equal(
          batch_y[1], np.array(df["output_1"].tolist()[:3])
      )
      # if one of the outputs is a 1D array
      df["output_1"] = [
          np.random.uniform(size=(2, 2, 1)).flatten()
          for _ in range(len(df))
      ]
      df_iterator = (
          image_data_generator.ImageDataGenerator().flow_from_dataframe(
              df,
              y_col=["output_0", "output_1"],
              directory=str(tmpdir),
              batch_size=3,
              shuffle=False,
              class_mode="multi_output",
          )
      )
      batch_x, batch_y = next(df_iterator)
      assert isinstance(batch_x, np.ndarray)
      assert len(batch_x.shape) == 4
      assert isinstance(batch_y, list)
      assert len(batch_y) == 2
      assert np.array_equal(
          batch_y[0], np.array(df["output_0"].tolist()[:3])
      )
      assert np.array_equal(
          batch_y[1], np.array(df["output_1"].tolist()[:3])
      )
      # if one of the outputs is a 2D array
      df["output_1"] = [
          np.random.uniform(size=(2, 2, 1)) for _ in range(len(df))
      ]
      df_iterator = (
          image_data_generator.ImageDataGenerator().flow_from_dataframe(
              df,
              y_col=["output_0", "output_1"],
              directory=str(tmpdir),
              batch_size=3,
              shuffle=False,
              class_mode="multi_output",
          )
      )
      batch_x, batch_y = next(df_iterator)
      assert isinstance(batch_x, np.ndarray)
      assert len(batch_x.shape) == 4
      assert isinstance(batch_y, list)
      assert len(batch_y) == 2
      assert np.array_equal(
          batch_y[0], np.array(df["output_0"].tolist()[:3])
      )
      assert np.array_equal(
          batch_y[1], np.array(df["output_1"].tolist()[:3])
      )
      # fail if single column
      with pytest.raises(TypeError):
          image_data_generator.ImageDataGenerator().flow_from_dataframe(
              df,
              y_col="output_0",
              directory=str(tmpdir),
              class_mode="multi_output",
          )
  
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 7 for calling a global function with example usage: test_dataframe_iterator_class_mode_multi_output(all_test_images, tmpdir) without return types