code: def test_branching_algos(
      algorithm: dict[str, dict],
      storage: BaseStorageProtocol,
      tmp_path: Path,
  ):
      exp = build_experiment(
          name="exp",
          space=space_with_fidelity,
          algorithm=algorithm,
          working_dir=tmp_path,
          storage=storage,
      )
  
      rosenbrock_with_fidelity.initialize()
      exp.workon(branching_rosenbrock, n_workers=2, trial_arg="trial")
  
      def build_params_hist(trial: Trial) -> list[str]:
          params = [trial.params_repr()]
          while trial.parent:
              assert isinstance(exp.algorithm, AlgoWrapper)
              trial = exp.algorithm.registry[trial.parent]
              params.append(trial.params_repr())
          return params[::-1]
  
      for trial in exp.fetch_trials():
          params_history = build_params_hist(trial)
          assert isinstance(exp.algorithm, AlgoWrapper)
          algo = exp.algorithm.unwrapped
          # TODO: This assumes algo.fidelities which may be specific to PBT...
          assert hasattr(algo, "fidelities")
          fidelities: list = algo.fidelities  # type: ignore
          assert (
              len(params_history)
              == fidelities.index(trial.params["noise"]) + 1
          )
          with open(os.path.join(trial.working_dir, "hist.txt")) as f:
              assert "\n".join(params_history) == f.read().strip("\n")
  
imports: from __future__ import annotations
  import copy
  import os
  from pathlib import Path
  import numpy
  import pytest
  from orion.algo.pbt.pb2_utils import import_optional
  from orion.client import build_experiment, create_experiment, workon
  from orion.core.io.space_builder import SpaceBuilder
  from orion.core.utils.module_import import ImportOptional
  from orion.core.worker.algo_wrappers import AlgoWrapper
  from orion.core.worker.primary_algo import SpaceTransform
  from orion.core.worker.trial import Trial
  from orion.storage.base import BaseStorageProtocol
  from orion.benchmark.task.base import BenchmarkTask
label_desc: Use image node_id 14 for calling a global function with example usage: test_branching_algos(algorithm, storage, tmp_path) and returns: params