code: def test_user_potential():
      model = pymc.Model()
      with model:
          pymc.Normal("a", mu=0, sigma=1)
  
      # Work around missing nonlocal in python2
      called = []
  
      class Potential(quadpotential.QuadPotentialDiag):
          def energy(self, x, velocity=None):
              called.append(1)
              return super().energy(x, velocity)
  
      pot = Potential(floatX([1]))
      with model:
          step = pymc.NUTS(potential=pot)
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "ignore", ".*number of samples.*", UserWarning
              )
              pymc.sample(10, step=step, chains=1)
      assert called
  
imports: import warnings
  import numpy
  import numpy.testing
  import pytest
  import scipy.sparse
  import pymc
  from pymc.pytensorf import floatX
  from pymc.step_methods.hmc import quadpotential
label_desc: Use image node_id 8 for calling a global function with example usage: test_user_potential() and returns: super