code: def test_fix_lost_trials_in_evc(storage, monkeypatch):
      """Test that lost trials from parents can be fixed as well.
  
      `fix_lost_trials` is tested more carefully in experiment's unit-tests (without the EVC).
      """
      with disable_duplication(monkeypatch), mocked_datetime(
          monkeypatch
      ):
          build_evc_tree(list(range(5)))
  
      for exp_name in [
          "root",
          "parent",
          "experiment",
          "child",
          "grand-child",
      ]:
          exp = get_experiment(name=exp_name)
          assert len(exp.fetch_trials(with_evc_tree=False)) == len(
              Trial.allowed_stati
          )
          assert (
              len(
                  exp.fetch_trials_by_status(
                      "reserved", with_evc_tree=False
                  )
              )
              == 1
          )
  
      experiment = build_experiment(name="experiment")
      experiment._experiment.fix_lost_trials()
  
      for exp_name in [
          "root",
          "parent",
          "experiment",
          "child",
          "grand-child",
      ]:
          exp = get_experiment(name=exp_name)
          assert len(exp.fetch_trials(with_evc_tree=False)) == len(
              Trial.allowed_stati
          )
          assert (
              len(
                  exp.fetch_trials_by_status(
                      "reserved", with_evc_tree=False
                  )
              )
              == 0
          )
  
file_path: orion/tests/functional/core/worker/test_experiment_functional.py
imports: import logging
  from orion.client import build_experiment, get_experiment
  from orion.core.io.database import DuplicateKeyError
  from orion.core.worker.trial import Trial
  from orion.testing import mocked_datetime
  from orion.testing.evc import build_child_experiment, build_root_experiment, disable_duplication
label_desc: Use image node_id 7 for calling a global function with example usage: test_fix_lost_trials_in_evc(storage, monkeypatch) without return types