code: def test_warm_starting_helps(
      algo: type[BaseAlgorithm],
      storage: BaseStorageProtocol,
  ):
      """Integration test. Shows that warm-starting helps in a simple task."""
      algo_config = {"of_type": algo.__qualname__.lower(), "seed": 42}
  
      # TODO: There still seems to be some randomness in this test, despite the algorithms being
      # seeded..
      np.random.seed(123)
      random.seed(123)
  
      source_task = simple_quadratic(a=1, b=-2, c=1)
      target_task = simple_quadratic(a=1, b=-2, c=1)
      # Note: minimum is at x = 1, with y = 0
      # Here we could prime the source task with points that should be super useful, since they
      # are really close to the minimum:
      source_space: Space = _space({"x": "uniform(0, 10)"})
      target_space: Space = _space({"x": "uniform(0, 10)"})
  
      n_source_trials = 50  # Number of trials from the source task
      max_trials = 10  # Number of trials in the target task
  
      source_experiment = build_experiment(
          name="source_exp",
          space=source_space,
          algorithm={"of_type": "random", "seed": 42},
          storage=storage,
          max_trials=n_source_trials,
      )
      source_experiment.workon(_wrap(source_task))
      # Create the Knowledge base by passing the now-filled Storage.
      knowledge_base = KnowledgeBase(storage=storage)
      assert knowledge_base.n_stored_experiments == 1
  
      without_warm_starting = workon(
          _wrap(target_task),
          name="witout_warm_start",
          space=target_space,
          max_trials=max_trials,
          algorithm=algo_config,
          knowledge_base=None,
      )
      assert len(without_warm_starting.fetch_trials()) == max_trials
  
      with_warm_starting = workon(
          _wrap(target_task),
          name="with_warm_start",
          space=target_space,
          max_trials=max_trials,
          algorithm=algo_config,
          knowledge_base=knowledge_base,
      )
      assert len(with_warm_starting.fetch_trials()) == max_trials
  
      best_trial_with = _get_best_trial(with_warm_starting)
      best_trial_without = _get_best_trial(without_warm_starting)
  
      objective_with = _get_objective(best_trial_with)
      objective_without = _get_objective(best_trial_without)
      assert objective_with < objective_without
  
imports: from __future__ import annotations
  import functools
  import random
  from pathlib import Path
  from typing import Callable
  import numpy
  import pytest
  from typing_extensions import ParamSpec
  from orion.algo.base import BaseAlgorithm
  from orion.algo.space import Space
  from orion.algo.tpe import TPE
  from orion.client import build_experiment, workon
  from orion.client.experiment import ExperimentClient
  from orion.core.io.space_builder import SpaceBuilder
  from orion.core.worker.trial import Trial
  from orion.core.worker.warm_start.knowledge_base import KnowledgeBase
  from orion.storage.base import BaseStorageProtocol, setup_storage
label_desc: Use image node_id 3 for calling a global function with example usage: test_warm_starting_helps(algo, storage) without return types