code: def test_candidates_filters_out_better_than_dummy(
      builder: EnsembleBuilder,
      make_run: Callable[..., Run],
  ) -> None:
      """
      Expects
      -------
      * Should filter out runs worse than dummy
      """
      metrics = builder.metrics
  
      bad_runs = [
          make_run(losses={m.name: 1 for m in metrics})
          for _ in range(2)
      ]
      dummy_run = make_run(
          dummy=True, losses={m.name: 0 for m in metrics}
      )
      good_runs = [
          make_run(losses={m.name: -1 for m in metrics})
          for _ in range(3)
      ]
  
      runs = bad_runs + good_runs
  
      candidates, discarded = builder.candidate_selection(
          runs,
          dummy_run,
          better_than_dummy=True,
      )
  
      assert set(candidates)
  
      assert len(candidates) == 3
  
      for run, metric in zip(candidates, metrics):
          assert run.losses[metric.name] < dummy_run.losses[metric.name]
  
      assert len(discarded) == 2
  
      for run, metric in zip(discarded, metrics):
          assert (
              run.losses[metric.name] >= dummy_run.losses[metric.name]
          )
  
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 10 for calling a global function with example usage: test_candidates_filters_out_better_than_dummy(builder, make_run) without return types