code: def test_eager(self):
      def mock_time():
          mock_time.time += 1
          return mock_time.time
  
      mock_time.time = 1556227801.875
      initial_time = mock_time.time
      with mock.patch("time.time", mock_time):
          self._initialize_model(writer=self.logdir)
          self.model.fit(x=[(1,)], y=[(2,)], callbacks=[self.callback])
      final_time = mock_time.time
  
      files = os.listdir(self.logdir)
      self.assertEqual(len(files), 1, files)
      events_file = os.path.join(self.logdir, files[0])
      plugin_data = []
      for event in tf.compat.v1.train.summary_iterator(events_file):
          if event.WhichOneof("what") != "summary":
              continue
          self.assertEqual(
              len(event.summary.value), 1, event.summary.value
          )
          value = event.summary.value[0]
          self.assertEqual(
              value.metadata.plugin_data.plugin_name,
              metadata.PLUGIN_NAME,
          )
          plugin_data.append(value.metadata.plugin_data.content)
  
      self.assertEqual(len(plugin_data), 2, plugin_data)
      (start_plugin_data, end_plugin_data) = plugin_data
      start_pb = metadata.parse_session_start_info_plugin_data(
          start_plugin_data
      )
      end_pb = metadata.parse_session_end_info_plugin_data(
          end_plugin_data
      )
  
      # We're not the only callers of `time.time`; Keras calls it
      # internally an unspecified number of times, so we're not guaranteed
      # to know the exact values. Instead, we perform relative checks...
      self.assertGreater(start_pb.start_time_secs, initial_time)
      self.assertLess(start_pb.start_time_secs, end_pb.end_time_secs)
      self.assertLessEqual(start_pb.start_time_secs, final_time)
      # ...and then stub out the times for proto equality checks below.
      start_pb.start_time_secs = 1234.5
      end_pb.end_time_secs = 6789.0
  
      expected_start_pb = plugin_data_pb2.SessionStartInfo()
      text_format.Parse(
          """
              start_time_secs: 1234.5
              group_name: "my_trial"
              hparams {
                key: "optimizer"
                value {
                  string_value: "adam"
                }
              }
              hparams {
                key: "dense_neurons"
                value {
                  number_value: 8.0
                }
              }
              """,
          expected_start_pb,
      )
      self.assertEqual(start_pb, expected_start_pb)
  
      expected_end_pb = plugin_data_pb2.SessionEndInfo()
      text_format.Parse(
          """
              end_time_secs: 6789.0
              status: STATUS_SUCCESS
              """,
          expected_end_pb,
      )
      self.assertEqual(end_pb, expected_end_pb)
  
file_path: tensorboard/tensorboard/plugins/hparams/_keras_test.py
imports: import os
  from unittest import mock
  from google.protobuf import text_format
  import tensorflow
  from tensorboard.plugins.hparams import _keras
  from tensorboard.plugins.hparams import metadata
  from tensorboard.plugins.hparams import plugin_data_pb2
  from tensorboard.plugins.hparams import summary_v2
label_desc: Use image node_id 3 for calling the CallbackTest obj's underlying member method code with example usage: obj.test_eager() and returns: mock_time