code: def test_partial_stats_iadd(self):
      stats = nlsg._PartialNLStats(
          invalidate=False, num_in_vocab_tokens=2, total_num_tokens=3
      )
      stats.vocab_token_length_quantiles.AddValues(pa.array([1, 2, 2]))
      stats.token_occurrence_counts.AddValues(
          pa.array([b"foo", b"bar", b"bar"])
      )
      stats.min_sequence_length = 3
      stats.max_sequence_length = 7
      stats.sequence_length_quantiles.AddValues(pa.array([1, 2, 2]))
      ts = nlsg._TokenStats()
      ts.frequency = 10
      ts.num_sequences = 2
      ts.per_sequence_min_frequency = 3
      ts.per_sequence_max_frequency = 7
      ts.positions[1] = 3
      ts.positions[2] = 7
      stats.token_statistics["foo"] = ts
  
      stats_2 = nlsg._PartialNLStats(
          invalidate=False, num_in_vocab_tokens=7, total_num_tokens=10
      )
      stats_2.vocab_token_length_quantiles.AddValues(pa.array([2, 3]))
      stats_2.token_occurrence_counts.AddValues(
          pa.array([b"bar", b"baz"])
      )
      stats_2.min_sequence_length = None
      stats_2.max_sequence_length = 9
      stats_2.sequence_length_quantiles.AddValues(pa.array([2, 3]))
      ts1 = nlsg._TokenStats()
      ts1.frequency = 12
      ts1.num_sequences = 1
      ts1.per_sequence_min_frequency = 4
      ts1.per_sequence_max_frequency = 8
      ts1.positions[1] = 12
      stats_2.token_statistics["foo"] = ts1
      stats_2.token_statistics["bar"] = ts1
  
      stats += stats_2
      self.assertEqual(9, stats.num_in_vocab_tokens)
      self.assertEqual(13, stats.total_num_tokens)
      self.assertEqual(3, stats.min_sequence_length)
      self.assertEqual(9, stats.max_sequence_length)
      self.assertEqual(False, stats.invalidate)
      token_occurrence_counts = (
          stats.token_occurrence_counts.Estimate().to_pylist()
      )
      self.assertListEqual(
          token_occurrence_counts,
          [
              {"values": b"bar", "counts": 3.0},
              {"values": b"baz", "counts": 1.0},
              {"values": b"foo", "counts": 1.0},
          ],
      )
      quantiles = stats.vocab_token_length_quantiles.GetQuantiles(2)
      quantiles = quantiles.flatten().to_pylist()
      self.assertListEqual(quantiles, [1, 2, 3])
  
      quantiles = stats.sequence_length_quantiles.GetQuantiles(2)
      quantiles = quantiles.flatten().to_pylist()
      self.assertListEqual(quantiles, [1, 2, 3])
  
      foo_ts_result = stats.token_statistics["foo"]
      bar_ts_result = stats.token_statistics["bar"]
  
      self.assertEqual(foo_ts_result.frequency, 22)
      self.assertEqual(foo_ts_result.num_sequences, 3)
      self.assertEqual(foo_ts_result.per_sequence_min_frequency, 3)
      self.assertEqual(foo_ts_result.per_sequence_max_frequency, 8)
      self.assertEqual(foo_ts_result.positions[1], 15)
      self.assertEqual(foo_ts_result.positions[2], 7)
  
      self.assertEqual(bar_ts_result.frequency, 12)
      self.assertEqual(bar_ts_result.num_sequences, 1)
      self.assertEqual(bar_ts_result.per_sequence_min_frequency, 4)
      self.assertEqual(bar_ts_result.per_sequence_max_frequency, 8)
      self.assertEqual(bar_ts_result.positions[1], 12)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tempfile
  from absl.testing import absltest
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import natural_language_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 NaturalLanguageStatsGeneratorTest obj's underlying member method code with example usage: obj.test_partial_stats_iadd() without return types