code: def test_warn_random_found_probability_inference(
      func, scipy_func, test_value
  ):
      # Fail if unexpected warning is issued
      with warnings.catch_warnings():
          warnings.simplefilter("error")
  
          input_rv = pm.Normal.dist(0, name="input")
          # Note: This graph could correspond to a convolution of two normals
          # In which case the inference should either return that or fail explicitly
          # For now, the lopgrob submodule treats the input as a stochastic value.
          rv = pt.exp(pm.Normal.dist(input_rv))
          with pytest.warns(
              UserWarning,
              match="RandomVariables {input} were found in the derived graph",
          ):
              assert func(rv, 0.0)
  
          res = func(rv, 0.0, warn_rvs=False)
          # This is the problem we are warning about, as now we can no longer identify the original rv in the graph
          # or replace it by the respective value
          assert rv not in ancestors([res])
  
          # Test that the prescribed solution does not raise a warning and works as expected
          input_vv = input_rv.clone()
          [new_rv] = replace_rvs_by_values(
              [rv],
              rvs_to_values={input_rv: input_vv},
              rvs_to_transforms={input_rv: LogTransform()},
          )
          input_vv_test = 1.3
          np.testing.assert_almost_equal(
              func(new_rv, test_value).eval({input_vv: input_vv_test}),
              getattr(
                  sp.lognorm(
                      s=1, loc=0, scale=np.exp(np.exp(input_vv_test))
                  ),
                  scipy_func,
              )(test_value),
          )
  
imports: import warnings
  import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  import scipy.stats.distributions
  from pytensor.graph.basic import ancestors, equal_computations
  from pytensor.tensor.random.op import RandomVariable
  from pytensor.tensor.subtensor import AdvancedIncSubtensor, AdvancedIncSubtensor1, IncSubtensor
  import pymc
  from pymc.logprob.basic import conditional_logp, icdf, logcdf, logp, transformed_conditional_logp
  from pymc.logprob.transforms import LogTransform
  from pymc.logprob.utils import replace_rvs_by_values
  from pymc.testing import assert_no_rvs
label_desc: Use image node_id 17 for calling a global function with example usage: test_warn_random_found_probability_inference(func, scipy_func, test_value) without return types