code: def test_with_invalid_utf8(self):
      b1 = pa.RecordBatch.from_arrays(
          [pa.array([[b"a"], [b"\xfc\xa1\xa1\xa1\xa1\xa1"], None])],
          ["a"],
      )
      b2 = pa.RecordBatch.from_arrays(
          [pa.array([[b"\xfc\xa1\xa1\xa1\xa1\xa1"]])], ["a"]
      )
      batches = [b1, b2]
      expected_result = {
          types.FeaturePath(["a"]): text_format.Parse(
              """
              type: STRING
              string_stats {
                common_stats {
                  num_non_missing: 3
                  num_missing: 1
                  min_num_values: 1
                  max_num_values: 1
                  avg_num_values: 1.0
                  num_values_histogram {
                    buckets {
                      low_value: 1.0
                      high_value: 1.0
                      sample_count: 0.75
                    }
                    buckets {
                      low_value: 1.0
                      high_value: 1.0
                      sample_count: 0.75
                    }
                    buckets {
                      low_value: 1.0
                      high_value: 1.0
                      sample_count: 0.75
                    }
                    buckets {
                      low_value: 1.0
                      high_value: 1.0
                      sample_count: 0.75
                    }
                    type: QUANTILES
                  }
                  tot_num_values: 3
                }
                avg_length: 4.333333
                invalid_utf8_count: 2
              }
              path {
                step: "a"
              }
              """,
              statistics_pb2.FeatureNameStatistics(),
          )
      }
      generator = basic_stats_generator.BasicStatsGenerator(
          num_values_histogram_buckets=4,
          num_histogram_buckets=3,
          num_quantiles_histogram_buckets=4,
      )
      self.assertCombinerOutputEqual(
          batches, generator, expected_result
      )
  
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import basic_stats_generator
  from tensorflow_data_validation.utils import test_util
  from tensorflow_data_validation.utils.example_weight_map import ExampleWeightMap
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 26 for calling the BasicStatsGeneratorTest obj's underlying member method code with example usage: obj.test_with_invalid_utf8() without return types