code: def test_emits_energy_warnings(self, caplog):
      with pm.Model():
          a = pm.Normal("a", size=2, initval=floatX(np.zeros(2)))
          a = pt.switch(a > 0, np.inf, a)
          b = pt.slinalg.solve(floatX(np.eye(2)), a, check_finite=False)
          pm.Normal("c", mu=b, size=2, initval=floatX(np.r_[0.0, 0.0]))
          caplog.clear()
          # The logger name must be specified for DEBUG level capturing to work
          with caplog.at_level(logging.DEBUG, logger="pymc"):
              idata = pm.sample(20, tune=5, chains=2, random_seed=526)
          assert any("Energy change" in w.msg for w in caplog.records)
  
imports: import logging
  import sys
  import warnings
  import numpy
  import pytensor.tensor
  import pytest
  import pymc
  from pymc.exceptions import SamplingError
  from pymc.pytensorf import floatX
  from pymc.step_methods.hmc import NUTS
  from tests import sampler_fixtures
  from tests.helpers import RVsAssignmentStepsTester, StepMethodTester
label_desc: Use image node_id 4 for calling the TestNutsCheckTrace obj's underlying member method code with example usage: obj.test_emits_energy_warnings(caplog) without return types