code: def test_observe():
      with pm.Model() as m_old:
          x = pm.Normal("x")
          y = pm.Normal("y", x)
          z = pm.Normal("z", y)
  
      m_new = observe(m_old, {y: 0.5})
  
      assert len(m_new.free_RVs) == 2
      assert len(m_new.observed_RVs) == 1
      assert m_new["x"] in m_new.free_RVs
      assert m_new["y"] in m_new.observed_RVs
      assert m_new["z"] in m_new.free_RVs
  
      np.testing.assert_allclose(
          m_old.compile_logp()({"x": 0.9, "y": 0.5, "z": 1.4}),
          m_new.compile_logp()({"x": 0.9, "z": 1.4}),
      )
  
      # Test two substitutions
      m_new = observe(m_old, {y: 0.5, z: 1.4})
  
      assert len(m_new.free_RVs) == 1
      assert len(m_new.observed_RVs) == 2
      assert m_new["x"] in m_new.free_RVs
      assert m_new["y"] in m_new.observed_RVs
      assert m_new["z"] in m_new.observed_RVs
  
      np.testing.assert_allclose(
          m_old.compile_logp()({"x": 0.9, "y": 0.5, "z": 1.4}),
          m_new.compile_logp()({"x": 0.9}),
      )
  
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 1 for calling a global function with example usage: test_observe() without return types