code: def test_set_priors():
      # NOTE I'm not sure if this test is OK. 'prior' and 'gp_prior' still point to the same
      #      object and that's why the `.auto_scale` attribute is updated in both..
      rng = np.random.default_rng(121195)
      data = pd.DataFrame(
          {
              "y": rng.normal(size=100),
              "x": rng.normal(size=100),
              "g": rng.choice(["A", "B"], size=100),
          }
      )
      model = bmb.Model("y ~ x + (1|g)", data)
      prior = bmb.Prior("Uniform", lower=0, upper=50)
      gp_prior = bmb.Prior(
          "Normal", mu=0, sigma=bmb.Prior("Normal", mu=0, sigma=1)
      )
  
      # Common
      model.set_priors(common=prior)
      assert model.response_component.terms["x"].prior == prior
  
      # Group-specific
      with pytest.raises(ValueError, match="must have hyperpriors"):
          model.set_priors(group_specific=prior)
  
      model.set_priors(group_specific=gp_prior)
      assert model.response_component.terms["1|g"].prior == gp_prior
  
      # By name
      model = bmb.Model("y ~ x + (1|g)", data)
      model.set_priors(priors={"Intercept": prior})
      model.set_priors(priors={"x": prior})
      model.set_priors(priors={"1|g": gp_prior})
      assert model.response_component.terms["Intercept"].prior == prior
      assert model.response_component.terms["x"].prior == prior
      assert model.response_component.terms["1|g"].prior == gp_prior
  
imports: from os.path import dirname, join
  import pytest
  import numpy
  import pymc
  import pandas
  from scipy import special
  import bambi
label_desc: Use image node_id 14 for calling a global function with example usage: test_set_priors() without return types