code: def test_init_groups(three_var_model, raises, grouping):
      with raises, three_var_model:
          approxes, groups = zip(*grouping)
          groups = [
              list(map(ft.partial(getattr, three_var_model), g))
              if g is not None
              else None
              for g in groups
          ]
          inited_groups = [a(group=g) for a, g in zip(approxes, groups)]
          approx = opvi.Approximation(inited_groups)
          for ig, g in zip(inited_groups, groups):
              if g is None:
                  pass
              else:
                  assert {pm.util.get_transformed(z) for z in g} == set(
                      ig.group
                  )
          else:
              model_dim = sum(
                  v.size
                  for v in three_var_model.initial_point(0).values()
              )
              assert approx.ndim == model_dim
          trace = approx.sample(100)
  
imports: import functools
  import numpy
  import pytensor.tensor
  import pytest
  import pymc
  from pymc.variational import opvi
  from pymc.variational.approximations import Empirical, EmpiricalGroup, FullRank, FullRankGroup, MeanField, MeanFieldGroup
  from tests.helpers import not_raises
label_desc: Use image node_id 6 for calling a global function with example usage: test_init_groups(three_var_model, raises, grouping) without return types