code: def test_nld_features(self):
      record_batches = [
          pa.RecordBatch.from_arrays([pa.array([[1]])], ["f1"])
      ]
      options = stats_options.StatsOptions(
          schema=text_format.Parse(
              """
                  feature {
                    name: "f1"
                    type: INT
                    natural_language_domain{
                      coverage {
                        excluded_int_tokens: 2
                      }
                    }
                  }
                """,
              schema_pb2.Schema(),
          )
      )
      expected_result = statistics_pb2.DatasetFeatureStatisticsList()
      expected_result.datasets.add()
      expected_result.datasets[0].num_examples = 1
      expected_result.datasets[0].features.add()
      expected_result.datasets[0].features[0].path.step.append("f1")
      expected_result.datasets[0].features[
          0
      ].string_stats.common_stats.num_non_missing = 1
      expected_result.datasets[0].features[
          0
      ].string_stats.common_stats.min_num_values = 1
      expected_result.datasets[0].features[
          0
      ].string_stats.common_stats.max_num_values = 1
      expected_result.datasets[0].features[
          0
      ].string_stats.common_stats.avg_num_values = 1.0
      for _ in range(10):
          expected_result.datasets[0].features[
              0
          ].string_stats.common_stats.num_values_histogram.buckets.add(
              low_value=1.0, high_value=1.0, sample_count=0.1
          )
      expected_result.datasets[0].features[
          0
      ].string_stats.common_stats.num_values_histogram.type = 1
      expected_result.datasets[0].features[
          0
      ].string_stats.common_stats.tot_num_values = 1
      expected_result.datasets[0].features[
          0
      ].string_stats.rank_histogram.buckets.add(
          label="1", sample_count=1.0
      )
      expected_result.datasets[0].features[0].string_stats.unique = 1
      expected_result.datasets[0].features[
          0
      ].string_stats.top_values.add(value="1", frequency=1.0)
      expected_result.datasets[0].features[
          0
      ].string_stats.avg_length = 1.0
  
      custom_nl_stats = (
          expected_result.datasets[0]
          .features[0]
          .custom_stats.add(name="nl_statistics")
      )
      nl_stats = statistics_pb2.NaturalLanguageStatistics(
          min_sequence_length=1,
          max_sequence_length=1,
          reported_sequences=["[1]", "[1]"],
      )
      nl_stats.sequence_length_histogram.type = (
          statistics_pb2.Histogram.QUANTILES
      )
      for _ in range(10):
          nl_stats.sequence_length_histogram.buckets.add(
              low_value=1, high_value=1, sample_count=0.1
          )
      custom_nl_stats.any.Pack(nl_stats)
      with beam.Pipeline() as p:
          result = (
              p
              | beam.Create(record_batches, reshuffle=False)
              | stats_impl.GenerateStatisticsImpl(options)
          )
          util.assert_that(
              result,
              test_util.make_dataset_feature_stats_list_proto_equal_fn(
                  self, expected_result, check_histograms=True
              ),
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import sys
  from typing import Iterable
  import unittest
  from absl.testing import absltest
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import pyarrow
  from tensorflow_data_validation.statistics import stats_impl
  from tensorflow_data_validation.statistics import stats_options
  from tensorflow_data_validation.statistics.generators import cross_feature_stats_generator
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.utils import slicing_util
  from tensorflow_data_validation.utils import test_util
  from tfx_bsl.arrow import array_util
  from tfx_bsl.arrow import table_util
  from tfx_bsl.public.proto import slicing_spec_pb2
  from tfx_bsl.statistics import merge_util
  from google.protobuf import text_format
  from tensorflow.python.util.protobuf import compare
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 4 for calling the StatsImplTest obj's underlying member method code with example usage: obj.test_nld_features() without return types