code: def test_emit_scalar(self):
      logdir = self.get_temp_dir()
      output = output_lib.DirectoryOutput(logdir)
      output.emit_scalar(
          plugin_name="plugin",
          tag="tag",
          data=np.float32(42.0),
          step=np.int64(12),
          wall_time=123.456,
          tag_metadata=b"meta",
          description="desc",
      )
      output.close()
      events = _test_util.read_tfevents(logdir)
      self.assertLen(events, 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, "tag")
      self.assertEqual(
          tensor_util.make_ndarray(summary.tensor), np.array(42.0)
      )
      self.assertEqual(summary.tensor.dtype, types_pb2.DT_FLOAT)
      self.assertEqual(
          summary.metadata.data_class, summary_pb2.DATA_CLASS_SCALAR
      )
      self.assertEqual(
          summary.metadata.plugin_data.plugin_name, "plugin"
      )
      self.assertEqual(summary.metadata.plugin_data.content, b"meta")
      self.assertEqual(summary.metadata.summary_description, "desc")
  
file_path: tensorboard/tensorboard/summary/_output_test.py
imports: import numpy
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.compat.proto import types_pb2
  from tensorboard.summary import _output
  from tensorboard.summary import _test_util
  from tensorboard.util import tensor_util
  from tensorboard import test
label_desc: Use image node_id 3 for calling the DirectoryOutputTest obj's underlying member method code with example usage: obj.test_emit_scalar() without return types