code: def test_do():
      rng = np.random.default_rng(seed=435)
      with pm.Model() as m_old:
          x = pm.Normal("x", 0, 1e-3)
          y = pm.Normal("y", x, 1e-3)
          z = pm.Normal("z", y + x, 1e-3)
  
      assert -5 < pm.draw(z, random_seed=rng) < 5
  
      m_new = do(m_old, {y: x + 100})
  
      assert len(m_new.free_RVs) == 2
      assert m_new["x"] in m_new.free_RVs
      assert m_new["y"] in m_new.deterministics
      assert m_new["z"] in m_new.free_RVs
  
      assert 95 < pm.draw(m_new["z"], random_seed=rng) < 105
  
      # Test two substitutions
      with m_old:
          switch = pm.MutableData("switch", 1)
      m_new = do(m_old, {y: 100 * switch, x: 100 * switch})
  
      assert len(m_new.free_RVs) == 1
      assert m_new["y"] not in m_new.deterministics
      assert m_new["x"] not in m_new.deterministics
      assert m_new["z"] in m_new.free_RVs
  
      assert 195 < pm.draw(m_new["z"], random_seed=rng) < 205
      with m_new:
          pm.set_data({"switch": 0})
      assert -5 < pm.draw(m_new["z"], random_seed=rng) < 5
  
imports: import arviz
  import numpy
  import pytest
  from pytensor import config
  import pymc
  from pymc.distributions.transforms import logodds
  from pymc.model.transform.conditioning import change_value_transforms, do, observe, remove_value_transforms
  from pymc.variational.minibatch_rv import create_minibatch_rv
label_desc: Use image node_id 5 for calling a global function with example usage: test_do() without return types