class_docstr: Tests for TopkUniquesStatsGenerator.
class_docstr_tok: ["Tests","for","TopkUniquesStatsGenerator","."]
code: def test_topk_uniques_with_missing_feature(self):
      # fa: 4 'a', 2 'b', 3 'c', 2 'd', 1 'e'
      # fb: 1 'a', 1 'b', 2 'c'
      examples = [
          pa.RecordBatch.from_arrays(
              [
                  pa.array([["a", "b", "c", "e"], None]),
                  pa.array(
                      [
                          ["a", "c", "c"],
                          ["b"],
                      ]
                  ),
              ],
              ["fa", "fb"],
          ),
          pa.RecordBatch.from_arrays(
              [
                  pa.array(
                      [["a", "c", "d"], ["a", "a", "b", "c", "d"], None]
                  )
              ],
              ["fa"],
          ),
      ]
  
      expected_result = [
          text_format.Parse(
              """
        features {
          path {
            step: 'fa'
          }
          string_stats {
            top_values {
              value: 'a'
              frequency: 4
            }
            top_values {
              value: 'c'
              frequency: 3
            }
            top_values {
              value: 'd'
              frequency: 2
            }
            top_values {
              value: 'b'
              frequency: 2
            }
            rank_histogram {
              buckets {
                low_rank: 0
                high_rank: 0
                label: "a"
                sample_count: 4.0
              }
              buckets {
                low_rank: 1
                high_rank: 1
                label: "c"
                sample_count: 3.0
              }
              buckets {
                low_rank: 2
                high_rank: 2
                label: "d"
                sample_count: 2.0
              }
            }
          }
        }""",
              statistics_pb2.DatasetFeatureStatistics(),
          ),
          text_format.Parse(
              """
        features {
          path {
            step: 'fb'
          }
          string_stats {
            top_values {
              value: 'c'
              frequency: 2
            }
            top_values {
              value: 'b'
              frequency: 1
            }
            top_values {
              value: 'a'
              frequency: 1
            }
            rank_histogram {
              buckets {
                low_rank: 0
                high_rank: 0
                label: "c"
                sample_count: 2.0
              }
              buckets {
                low_rank: 1
                high_rank: 1
                label: "b"
                sample_count: 1.0
              }
              buckets {
                low_rank: 2
                high_rank: 2
                label: "a"
                sample_count: 1.0
              }
            }
          }
      }""",
              statistics_pb2.DatasetFeatureStatistics(),
          ),
          text_format.Parse(
              """
      features {
          path {
            step: 'fa'
          }
          string_stats {
            unique: 5
          }
        }""",
              statistics_pb2.DatasetFeatureStatistics(),
          ),
          text_format.Parse(
              """
      features {
          path {
            step: 'fb'
          }
          string_stats {
            unique: 3
          }
        }""",
              statistics_pb2.DatasetFeatureStatistics(),
          ),
      ]
  
      generator = (
          top_k_uniques_stats_generator.TopKUniquesStatsGenerator(
              num_top_values=4, num_rank_histogram_buckets=3
          )
      )
      self.assertSlicingAwareTransformOutputEqual(
          examples,
          generator,
          expected_result,
          add_default_slice_key_to_input=True,
          add_default_slice_key_to_output=True,
      )
  
imports: from absl.testing import absltest
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import top_k_uniques_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 7 for calling the TopkUniquesStatsGeneratorTest obj's underlying member method code with example usage: obj.test_topk_uniques_with_missing_feature() without return types