code: def test_categorical_term():
      rng = np.random.default_rng(121195)
      data = pd.DataFrame(
          {
              "y": rng.normal(size=6),
              "x1": rng.normal(size=6),
              "x2": [1, 1, 0, 0, 1, 1],
              "g1": ["a"] * 3 + ["b"] * 3,
              "g2": ["x", "x", "z", "z", "y", "y"],
          }
      )
      model = bmb.Model("y ~ x1 + x2 + g1 + (g1|g2) + (x2|g2)", data)
      fitted = model.fit(tune=100, draws=100)
      df = az.summary(fitted)
      names = {
          "Intercept",
          "x1",
          "x2",
          "g1[b]",
          "1|g2_sigma",
          "g1|g2_sigma[b]",
          "x2|g2_sigma",
          "y_sigma",
          "1|g2[x]",
          "1|g2[y]",
          "1|g2[z]",
          "g1|g2[b, x]",
          "g1|g2[b, y]",
          "g1|g2[b, z]",
          "x2|g2[x]",
          "x2|g2[y]",
          "x2|g2[z]",
      }
      assert set(df.index) == names
  
imports: import logging
  from functools import reduce
  from operator import add
  from os.path import dirname, join
  import arviz
  import numpy
  import pandas
  import pymc
  import pytest
  from formulae import design_matrices
  import bambi
  from bambi.terms import CommonTerm, GroupSpecificTerm
label_desc: Use image node_id 17 for calling a global function with example usage: test_categorical_term() without return types