code: def test_image_stats_generator_real_image(self):
      test_data_dir = os.path.join(
          os.path.dirname(__file__), "testdata"
      )
      batches = [
          pa.array(
              [
                  [
                      _read_file(
                          os.path.join(test_data_dir, "image1.gif")
                      ),
                      _read_file(
                          os.path.join(test_data_dir, "image2.png")
                      ),
                      _read_file(
                          os.path.join(test_data_dir, "image5.jpg")
                      ),
                      _read_file(
                          os.path.join(test_data_dir, "image6.jpg")
                      ),
                      _read_file(
                          os.path.join(test_data_dir, "not_a_image.abc")
                      ),
                  ],
                  [
                      _read_file(
                          os.path.join(test_data_dir, "image3.bmp")
                      ),
                      b"not_a_image",
                  ],
              ]
          ),
          pa.array(
              [
                  [
                      _read_file(
                          os.path.join(test_data_dir, "image4.png")
                      ),
                  ]
              ]
          ),
      ]
      expected_result = text_format.Parse(
          """
              custom_stats {
                name: 'domain_info'
                str: 'image_domain {}'
              }
              custom_stats {
                name: 'image_format_histogram'
                rank_histogram {
                  buckets {
                    label: 'UNKNOWN'
                    sample_count: 2
                  }
                  buckets {
                    label: 'bmp'
                    sample_count: 1
                  }
                  buckets {
                    label: 'gif'
                    sample_count: 1
                  }
                  buckets {
                    label: 'jpeg'
                    sample_count: 2
                  }
                  buckets {
                    label: 'png'
                    sample_count: 2
                  }
                }
              }
              custom_stats {
                name: 'image_max_width'
                num: 300.0
              }
              custom_stats {
                name: 'image_max_height'
                num: 300.0
              }
              """,
          statistics_pb2.FeatureNameStatistics(),
      )
      generator = image_stats_generator.ImageStatsGenerator(
          is_image_ratio_threshold=0.6,
          values_threshold=1,
          enable_size_stats=True,
      )
      self.assertCombinerOutputEqual(
          batches, generator, expected_result
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import os
  import pickle
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_data_validation.statistics.generators import image_stats_generator
  from tensorflow_data_validation.utils import test_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 1 for calling the ImageStatsGeneratorRealImageTest obj's underlying member method code with example usage: obj.test_image_stats_generator_real_image() without return types