code: def test_gradient():
      for scale in (0.1, 0.5, 1.0, 2.0):
          prior = HorseshoePrior(scale=scale, seed=1)
          # The function appears to be unstable above 15
          for theta in range(-20, 15):
              if theta == 0:
                  continue
  
              wrap_lnprob_ = partial(wrap_lnprob, prior=prior)
              wrap_gradient_ = partial(wrap_gradient, prior=prior)
  
              error = scipy.optimize.check_grad(
                  wrap_lnprob_,
                  wrap_gradient_,
                  np.array([theta]),
                  epsilon=1e-5,
              )
              assert pytest.approx(error) == 0
  
imports: from functools import partial
  import numpy
  import pytest
  import scipy.optimize
  from smac.constants import VERY_SMALL_NUMBER
  from smac.model.gaussian_process.priors import GammaPrior, HorseshoePrior, LogNormalPrior, SoftTopHatPrior, TophatPrior
label_desc: Use image node_id 10 for calling a global function with example usage: test_gradient() without return types