code: def test_change_rv_size_default_update():
      rng = pytensor.shared(np.random.default_rng(0))
      x = normal(rng=rng)
  
      # Test that "traditional" default_update is translated to the new rng
      rng.default_update = x.owner.outputs[0]
      new_x = change_dist_size(x, new_size=(2,))
      new_rng = new_x.owner.inputs[0]
      assert rng.default_update is x.owner.outputs[0]
      assert new_rng.default_update is new_x.owner.outputs[0]
  
      # Test that "non-traditional" default_update raises UserWarning
      next_rng = pytensor.shared(np.random.default_rng(1))
      rng.default_update = next_rng
      with pytest.warns(
          UserWarning,
          match="could not be replicated in resized variable",
      ):
          new_x = change_dist_size(x, new_size=(2,))
      new_rng = new_x.owner.inputs[0]
      assert rng.default_update is next_rng
      assert new_rng.default_update is None
  
      # Test that default_update is not set if it was None before
      rng.default_update = None
      new_x = change_dist_size(x, new_size=(2,))
      new_rng = new_x.owner.inputs[0]
      assert new_rng.default_update is None
  
imports: import re
  import warnings
  import numpy
  import pytensor
  import pytest
  from pytensor import tensor
  from pytensor.compile.mode import Mode
  from pytensor.graph import Constant, ancestors
  from pytensor.tensor import TensorVariable
  from pytensor.tensor.random import normal
  from pytensor.tensor.shape import SpecifyShape
  import pymc
  from pymc import ShapeError
  from pymc.distributions.shape_utils import broadcast_dist_samples_shape, change_dist_size, convert_dims, convert_shape, convert_size, get_support_shape, get_support_shape_1d, rv_size_is_none, to_tuple
  from pymc.model import Model
label_desc: Use image node_id 6 for calling a global function with example usage: test_change_rv_size_default_update() without return types