class_docstr: Helper functions for testing.
  
  Primarily provided for tests that use fixture (and derived)
  `three_experiments_branch_same_name_trials_benchmarks`
class_docstr_tok: ["Helper","functions","for","testing",".","Primarily","provided","for","tests","that","use","fixture","(","and","derived",")","`","three_experiments_branch_same_name_trials_benchmarks","`"]
docstr: Check experiment.
  - Check if we found experiment.
  - Check if we found exactly 1 algorithm for this experiment.
  - Check algo state if algo_state is provided
  - Check if we found expected number of trials for this experiment.
  - Check if we found expecter number of child trials into experiment trials.
  - Check if we found expected trial links if provided.
code: def check_exp(
      db,
      name,
      version,
      nb_trials,
      nb_child_trials=0,
      algo_state=None,
      trial_links=None,
  ):
      """Check experiment.
      - Check if we found experiment.
      - Check if we found exactly 1 algorithm for this experiment.
      - Check algo state if algo_state is provided
      - Check if we found expected number of trials for this experiment.
      - Check if we found expecter number of child trials into experiment trials.
      - Check if we found expected trial links if provided.
      """
      experiments = db.read(
          "experiments", {"name": name, "version": version}
      )
      assert len(experiments) == 1
      (experiment,) = experiments
      algos = db.read("algo", {"experiment": experiment["_id"]})
      trials = db.read("trials", {"experiment": experiment["_id"]})
      assert len(algos) == 1
      assert len(trials) == nb_trials
  
      if algo_state is not None:
          (algo,) = algos
          assert algo_state == pickle.loads(algo["state"])
  
      trial_map = {trial["id"]: trial for trial in trials}
      assert len(trial_map) == nb_trials
      child_trials = []
      for trial in trials:
          parent = trial["parent"]
          if parent is not None:
              assert parent in trial_map
              child_trials.append(trial)
      assert len(child_trials) == nb_child_trials
  
      if trial_links is not None:
          trial_graph = get_trial_parent_links(trials)
          given_links = sorted(trial_graph.get_sorted_links())
          trial_links = sorted(trial_links)
          assert len(trial_links) == len(given_links)
          assert trial_links == given_links
  
imports: import copy
  import os
  import pickle
  import zlib
  from collections import Counter
  from tempfile import NamedTemporaryFile
  import pytest
  import yaml
  import orion.core.cli
  import orion.core.io.experiment_builder
  import orion.core.utils.backward
  from orion.core.worker.trial import Trial
  from orion.storage.backup import _get_exp_key, dump_database, get_experiment_parent_links, get_experiment_root_links, get_trial_parent_links
label_desc: Use image node_id 2 for calling the _Helpers obj's underlying member method code with example usage: obj.check_exp(db, name, version, nb_trials, nb_child_trials, algo_state, trial_links) without return types