code: def test_real_directory(self):
      logdir = self.get_temp_dir()
      w = writer_lib.Writer(logdir)
      w.add_scalar(
          "foo", 42.0, 12, wall_time=123.456, description="fooful"
      )
      w.close()
      events = _test_util.read_tfevents(logdir)
      self.assertLen(events, 2)
      self.assertEqual(events[0].file_version, "brain.Event:2")
      event = events[1]
      self.assertEqual(event.step, 12)
      self.assertEqual(event.wall_time, 123.456)
      summary = event.summary.value[0]
      self.assertEqual(summary.tag, "foo")
      self.assertEqual(
          tensor_util.make_ndarray(summary.tensor), np.array(42.0)
      )
      self.assertEqual(
          summary.metadata.data_class, summary_pb2.DATA_CLASS_SCALAR
      )
      self.assertEqual(
          summary.metadata.plugin_data.plugin_name, "scalars"
      )
      self.assertEqual(summary.metadata.summary_description, "fooful")
  
imports: import time
  from unittest import mock
  import numpy
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.summary import _output
  from tensorboard.summary import _writer
  from tensorboard.summary import _test_util
  from tensorboard.util import tensor_util
  from tensorboard import test
label_desc: Use image node_id 1 for calling the WriterAddScalarTest obj's underlying member method code with example usage: obj.test_real_directory() without return types