code: def test_dataframe_iterator_classes_indices_order(
      all_test_images, tmpdir
  ):
      # save the images in the paths
      count = 0
      filenames = []
      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
  
      # Test the class_indices without classes input
      generator = image_data_generator.ImageDataGenerator()
      label_opt = ["a", "b", ["a"], ["b"], ["a", "b"], ["b", "a"]]
      df_f = pd.DataFrame(
          {
              "filename": filenames,
              "class": ["a", "b"]
              + [random.choice(label_opt) for _ in filenames[:-2]],
          }
      )
      flow_forward_iter = generator.flow_from_dataframe(
          df_f, str(tmpdir)
      )
      label_rev = ["b", "a", ["b"], ["a"], ["b", "a"], ["a", "b"]]
      df_r = pd.DataFrame(
          {
              "filename": filenames,
              "class": ["b", "a"]
              + [random.choice(label_rev) for _ in filenames[:-2]],
          }
      )
      flow_backward_iter = generator.flow_from_dataframe(
          df_r, str(tmpdir)
      )
  
      # check class_indices
      assert (
          flow_forward_iter.class_indices
          == flow_backward_iter.class_indices
      )
  
      # Test the class_indices with classes input
      generator_2 = image_data_generator.ImageDataGenerator()
      df_f2 = pd.DataFrame(
          [["data/A.jpg", "A"], ["data/B.jpg", "B"]],
          columns=["filename", "class"],
      )
      flow_forward = generator_2.flow_from_dataframe(
          df_f2, classes=["A", "B"]
      )
      df_b2 = pd.DataFrame(
          [["data/A.jpg", "A"], ["data/B.jpg", "B"]],
          columns=["filename", "class"],
      )
      flow_backward = generator_2.flow_from_dataframe(
          df_b2, classes=["B", "A"]
      )
  
      # check class_indices
      assert flow_forward.class_indices != flow_backward.class_indices
  
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 14 for calling a global function with example usage: test_dataframe_iterator_classes_indices_order(all_test_images, tmpdir) without return types