code: def suggestion_testing(
      name: str,
      instrumentation: ng.p.Array,
      suggestion: np.ndarray,
      budget: int,
      objective_function: tp.Callable[..., tp.Any],
      optimum: tp.Optional[np.ndarray] = None,
      threshold: tp.Optional[float] = None,
  ):
      optimizer_cls = registry[name]
      optim = optimizer_cls(instrumentation, budget)
      if optimum is None:
          optimum = suggestion
      optim.suggest(suggestion)
      optim.minimize(objective_function)
      if threshold is not None:
          assert (
              objective_function(optim.recommend().value) < threshold
          ), f"{name} proposes {optim.recommend().value} instead of {optimum} (threshold={threshold})"
          return
      assert np.all(
          optim.recommend().value == optimum
      ), f"{name} proposes {optim.recommend().value} instead of {optimum}"
  
file_path: nevergrad/nevergrad/optimization/test_suggest.py
imports: import pytest
  import numpy
  import sys
  from unittest import SkipTest
  import nevergrad
  import nevergrad.common.typing
  from nevergrad.common import testing
  from .None import base
  from .optimizerlib import registry
label_desc: Use image node_id 2 for calling a global function with example usage: suggestion_testing(name, instrumentation, suggestion, budget, objective_function, optimum, threshold) without return types