docstr: Test accumulator by writing values and then reading them.
code: def testScalarsRealistically(self):
      """Test accumulator by writing values and then reading them."""
  
      def FakeScalarSummary(tag, value):
          value = summary_pb2.Summary.Value(tag=tag, simple_value=value)
          summary = summary_pb2.Summary(value=[value])
          return summary
  
      directory = os.path.join(self.get_temp_dir(), "values_dir")
      if tf.io.gfile.isdir(directory):
          tf.io.gfile.rmtree(directory)
      tf.io.gfile.mkdir(directory)
  
      writer = test_util.FileWriter(directory, max_queue=100)
  
      with tf.Graph().as_default() as graph:
          _ = tf.constant([2.0, 1.0])
      # Add a graph to the summary writer.
      writer.add_graph(graph)
      meta_graph_def = tf.compat.v1.train.export_meta_graph(
          graph_def=graph.as_graph_def(add_shapes=True)
      )
      writer.add_meta_graph(meta_graph_def)
  
      run_metadata = config_pb2.RunMetadata()
      device_stats = run_metadata.step_stats.dev_stats.add()
      device_stats.device = "test device"
      writer.add_run_metadata(run_metadata, "test run")
  
      # Write a bunch of events using the writer.
      for i in range(30):
          summ_id = FakeScalarSummary("id", i)
          summ_sq = FakeScalarSummary("sq", i * i)
          writer.add_summary(summ_id, i * 5)
          writer.add_summary(summ_sq, i * 5)
      writer.flush()
  
      # Verify that we can load those events properly
      acc = ea.EventAccumulator(directory)
      acc.Reload()
      self.assertTagsEqual(
          acc.Tags(),
          {
              ea.SCALARS: ["id", "sq"],
              ea.GRAPH: True,
              ea.META_GRAPH: True,
              ea.RUN_METADATA: ["test run"],
          },
      )
      id_events = acc.Scalars("id")
      sq_events = acc.Scalars("sq")
      self.assertEqual(30, len(id_events))
      self.assertEqual(30, len(sq_events))
      for i in range(30):
          self.assertEqual(i * 5, id_events[i].step)
          self.assertEqual(i * 5, sq_events[i].step)
          self.assertEqual(i, id_events[i].value)
          self.assertEqual(i * i, sq_events[i].value)
  
      # Write a few more events to test incremental reloading
      for i in range(30, 40):
          summ_id = FakeScalarSummary("id", i)
          summ_sq = FakeScalarSummary("sq", i * i)
          writer.add_summary(summ_id, i * 5)
          writer.add_summary(summ_sq, i * 5)
      writer.flush()
  
      # Verify we can now see all of the data
      acc.Reload()
      id_events = acc.Scalars("id")
      sq_events = acc.Scalars("sq")
      self.assertEqual(40, len(id_events))
      self.assertEqual(40, len(sq_events))
      for i in range(40):
          self.assertEqual(i * 5, id_events[i].step)
          self.assertEqual(i * 5, sq_events[i].step)
          self.assertEqual(i, id_events[i].value)
          self.assertEqual(i * i, sq_events[i].value)
  
      expected_graph_def = graph_pb2.GraphDef.FromString(
          graph.as_graph_def(add_shapes=True).SerializeToString()
      )
      self.assertProtoEquals(expected_graph_def, acc.Graph())
  
      expected_meta_graph = meta_graph_pb2.MetaGraphDef.FromString(
          meta_graph_def.SerializeToString()
      )
      self.assertProtoEquals(expected_meta_graph, acc.MetaGraph())
  
imports: import os
  import numpy
  import tensorflow
  from tensorboard.backend.event_processing import event_accumulator
  from tensorboard.compat.proto import config_pb2
  from tensorboard.compat.proto import event_pb2
  from tensorboard.compat.proto import graph_pb2
  from tensorboard.compat.proto import meta_graph_pb2
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.plugins.distribution import compressor
  from tensorboard.util import tensor_util
  from tensorboard.util import test_util
  from tensorboard.util import tb_logging
label_desc: Use image node_id 1 for calling the RealisticEventAccumulatorTest obj's underlying member method code with example usage: obj.testScalarsRealistically() and returns: summary