code: def test_will_build_ensemble_with_different_metrics(
      make_ensemble_builder: Callable[..., EnsembleBuilder],
      make_run: Callable[..., Run],
      metrics: Scorer | list[Scorer],
  ) -> None:
      """
      Expects
      -------
      * Should be able to build a valid ensemble with different combinations of metrics
      * Should produce a validation score for both "ensemble" and "test" scores
      """
      if not isinstance(metrics, list):
          metrics = [metrics]
  
      builder = make_ensemble_builder(metrics=metrics)
  
      # Make some runs and stick them in the same backend as the builder
      # Dummy just has a terrible loss for all metrics
      make_run(
          dummy=True,
          losses={m.name: 1000 for m in metrics},
          backend=builder.backend,
      )
  
      # "Proper" runs will have the correct targets and so be better than dummy
      run_predictions = {
          "ensemble": builder.targets("ensemble"),
          "test": builder.targets("test"),
      }
      for _ in range(5):
          make_run(predictions=run_predictions, backend=builder.backend)
  
      history, nbest = builder.main()
  
      # Should only produce one step
      assert len(history) == 1
      hist = history[0]
  
      # Each of these two keys should be present
      for key in ["ensemble_optimization_score", "ensemble_test_score"]:
          assert key in hist
  
imports: from __future__ import annotations
  from typing import Callable
  import random
  import time
  from pathlib import Path
  import numpy
  from autosklearn.automl_common.common.utils.backend import Backend
  from autosklearn.ensemble_building import EnsembleBuilder, Run
  from autosklearn.metrics import Scorer, accuracy, make_scorer
  from autosklearn.util.functional import bound, pairs
  import pytest
  from pytest_cases import fixture, parametrize
  from unittest.mock import Mock, patch
  from test.conftest import DEFAULT_SEED
  from test.fixtures.metrics import acc_with_X_data
label_desc: Use image node_id 29 for calling a global function with example usage: test_will_build_ensemble_with_different_metrics(make_ensemble_builder, make_run, metrics) without return types