code: def test_functional_single_output(self, model_fn, loss_type):
      model = model_fn()
      self.assertIsInstance(model, Functional)
      loss = "mean_squared_error"
      if loss_type == "list":
          loss = [loss]
      elif loss_type == "dict":
          loss = {"output_a": loss}
      elif loss_type == "dict_lsit":
          loss = {"output_a": [loss]}
      model.compile(
          optimizer="sgd",
          loss=loss,
          metrics={
              "output_a": ["mean_squared_error", "mean_absolute_error"],
          },
          weighted_metrics={
              "output_a": "mean_squared_error",
          },
      )
      # Fit the model to make sure compile_metrics are built
      x = np.random.rand(8, 3)
      y = np.random.rand(8, 1)
      hist = model.fit(
          x,
          y,
          batch_size=2,
          epochs=1,
          verbose=0,
      )
      hist_keys = sorted(hist.history.keys())
      ref_keys = sorted(
          [
              "loss",
              "mean_absolute_error",
              "mean_squared_error",
              "weighted_mean_squared_error",
          ]
      )
      self.assertListEqual(hist_keys, ref_keys)
  
imports: import numpy
  import pytest
  from absl.testing import parameterized
  from keras import layers
  from keras import testing
  from keras.layers.core.input_layer import Input
  from keras.models.functional import Functional
  from keras.models.model import Model
  from keras.models.model import model_from_json
label_desc: Use image node_id 5 for calling the ModelTest obj's underlying member method code with example usage: obj.test_functional_single_output(model_fn, loss_type) without return types