code: def test_write_stats_to_binary_file(self):
      stats = text_format.Parse(
          """
          datasets {
            name: 'x'
            num_examples: 100
          }
          """,
          statistics_pb2.DatasetFeatureStatisticsList(),
      )
      output_path = os.path.join(self._get_temp_dir(), "stats")
      with beam.Pipeline() as p:
          _ = (
              p
              | beam.Create([stats])
              | stats_api.WriteStatisticsToBinaryFile(output_path)
          )
      stats_from_file = statistics_pb2.DatasetFeatureStatisticsList()
      serialized_stats = io_util.read_file_to_string(
          output_path, binary_mode=True
      )
      stats_from_file.ParseFromString(serialized_stats)
      self.assertLen(stats_from_file.datasets, 1)
      test_util.assert_dataset_feature_stats_proto_equal(
          self, stats_from_file.datasets[0], stats.datasets[0]
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tempfile
  from absl.testing import absltest
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_data_validation.api import stats_api
  from tensorflow_data_validation.utils import artifacts_io_impl
  from tensorflow_data_validation.statistics import stats_options
  from tensorflow_data_validation.utils import io_util
  from tensorflow_data_validation.utils import stats_util
  from tensorflow_data_validation.utils import test_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 7 for calling the StatsAPITest obj's underlying member method code with example usage: obj.test_write_stats_to_binary_file() without return types