code: def test_convert_to_metrics_with_history():
      model = keras.Sequential([keras.layers.Dense(1)])
      model.compile(loss="mse", metrics=["mae"])
      val_x = np.random.rand(10, 10)
      val_y = np.random.rand(10, 10)
      history = model.fit(
          x=np.random.rand(10, 10),
          y=np.random.rand(10, 1),
          validation_data=(val_x, val_y),
      )
  
      results = tuner_utils.convert_to_metrics_dict(
          history,
          obj_module.Objective("val_loss", "min"),
      )
      assert all(
          key in results
          for key in ["loss", "val_loss", "mae", "val_mae"]
      )
  
file_path: keras-tuner/keras_tuner/engine/tuner_utils_test.py
imports: import os
  import numpy
  import pytest
  from keras_tuner.backend import keras
  from keras_tuner.engine import objective
  from keras_tuner.engine import tuner_utils
label_desc: Use image node_id 4 for calling a global function with example usage: test_convert_to_metrics_with_history() without return types