code: def test_nested_ifelse():
      idx = pt.scalar("idx", dtype=int)
  
      dist0 = pt.random.normal(-5, 1)
      dist1 = pt.random.normal(0, 1)
      dist2 = pt.random.normal(5, 1)
      mix = ifelse(
          pt.eq(idx, 0), dist0, ifelse(pt.eq(idx, 1), dist1, dist2)
      )
      mix.name = "mix"
  
      value = mix.clone()
      mix_logp = logp(mix, value)
      assert mix_logp.name == "mix_logprob"
      mix_logp_fn = pytensor.function([idx, value], mix_logp)
  
      test_value = 0.25
      np.testing.assert_almost_equal(
          mix_logp_fn(0, test_value), sp.norm.logpdf(test_value, -5, 1)
      )
      np.testing.assert_almost_equal(
          mix_logp_fn(1, test_value), sp.norm.logpdf(test_value, 0, 1)
      )
      np.testing.assert_almost_equal(
          mix_logp_fn(2, test_value), sp.norm.logpdf(test_value, 5, 1)
      )
  
imports: import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  import scipy.stats.distributions
  from pytensor import function
  from pytensor.graph.basic import Variable
  from pytensor.ifelse import ifelse
  from pytensor.tensor.random.basic import CategoricalRV
  from pytensor.tensor.shape import shape_tuple
  from pytensor.tensor.subtensor import AdvancedSubtensor, AdvancedSubtensor1, Subtensor, as_index_constant
  from pymc.logprob.abstract import MeasurableVariable
  from pymc.logprob.basic import conditional_logp, logp
  from pymc.logprob.mixture import MeasurableSwitchMixture, expand_indices
  from pymc.logprob.rewriting import construct_ir_fgraph
  from pymc.logprob.utils import dirac_delta
  from pymc.testing import assert_no_rvs
  from tests.logprob.utils import scipy_logprob
label_desc: Use image node_id 18 for calling a global function with example usage: test_nested_ifelse() without return types