code: def test_shared_weight(self):
      batches = [
          pa.RecordBatch.from_arrays(
              [
                  pa.array([["a"], ["a", "b"], ["a"]]),
                  pa.array([["x"], ["y"], ["x"]]),
                  pa.array([[2], [4], None]),
              ],
              ["value1", "value2", "weight"],
          )
      ]
      schema = text_format.Parse(
          """
          weighted_feature {
            name: 'weighted_feature1'
            feature {
              step: 'value1'
            }
            weight_feature {
              step: 'weight'
            }
          }
          weighted_feature {
            name: 'weighted_feature2'
            feature {
              step: 'value2'
            }
            weight_feature {
              step: 'weight'
            }
          }""",
          schema_pb2.Schema(),
      )
      generator = weighted_feature_stats_generator.WeightedFeatureStatsGenerator(
          schema
      )
  
      expected_result = {
          types.FeaturePath(["weighted_feature1"]): text_format.Parse(
              """
                  path {
                    step: 'weighted_feature1'
                  }
                  custom_stats {
                    name: 'missing_weight'
                    num: 1.0
                  }
                  custom_stats {
                    name: 'missing_value'
                    num: 0.0
                  }
                  custom_stats {
                    name: 'min_weight_length_diff'
                    num: -1.0
                  }
                  custom_stats {
                    name: 'max_weight_length_diff'
                    num: 0.0
                  }""",
              statistics_pb2.FeatureNameStatistics(),
          ),
          types.FeaturePath(["weighted_feature2"]): text_format.Parse(
              """
                  path {
                    step: 'weighted_feature2'
                  }
                  custom_stats {
                    name: 'missing_weight'
                    num: 1.0
                  }
                  custom_stats {
                    name: 'missing_value'
                    num: 0.0
                  }
                  custom_stats {
                    name: 'min_weight_length_diff'
                    num: -1.0
                  }
                  custom_stats {
                    name: 'max_weight_length_diff'
                    num: 0.0
                  }""",
              statistics_pb2.FeatureNameStatistics(),
          ),
      }
  
      self.assertCombinerOutputEqual(
          batches, generator, expected_result
      )
  
file_path: data-validation/tensorflow_data_validation/statistics/generators/weighted_feature_stats_generator_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import absltest
  from absl.testing import parameterized
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import weighted_feature_stats_generator
  from tensorflow_data_validation.utils import test_util
  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 2 for calling the WeightedFeatureStatsGeneratorTest obj's underlying member method code with example usage: obj.test_shared_weight() without return types