code: def t(
      formula_like,
      data,
      depth,
      expect_full_designs,
      expected_rhs_values,
      expected_rhs_names,
      expected_lhs_values=None,
      expected_lhs_names=None,
  ):  # pragma: no cover
      if isinstance(depth, int):
          depth += 1
  
      def data_iter_maker():
          return iter([data])
  
      if (
          isinstance(
              formula_like, six.string_types + (ModelDesc, DesignInfo)
          )
          or (
              isinstance(formula_like, tuple)
              and isinstance(formula_like[0], DesignInfo)
          )
          or hasattr(formula_like, "__patsy_get_model_desc__")
      ):
          if expected_lhs_values is None:
              builder = incr_dbuilder(
                  formula_like, data_iter_maker, depth
              )
              lhs = None
              (rhs,) = build_design_matrices([builder], data)
          else:
              builders = incr_dbuilders(
                  formula_like, data_iter_maker, depth
              )
              lhs, rhs = build_design_matrices(builders, data)
          check_result(
              expect_full_designs,
              lhs,
              rhs,
              data,
              expected_rhs_values,
              expected_rhs_names,
              expected_lhs_values,
              expected_lhs_names,
          )
      else:
          pytest.raises(
              PatsyError, incr_dbuilders, formula_like, data_iter_maker
          )
          pytest.raises(
              PatsyError, incr_dbuilder, formula_like, data_iter_maker
          )
      one_mat_fs = [dmatrix]
      two_mat_fs = [dmatrices]
      if have_pandas:
          one_mat_fs.append(dmatrix_pandas)
          two_mat_fs.append(dmatrices_pandas)
      if expected_lhs_values is None:
          for f in one_mat_fs:
              rhs = f(formula_like, data, depth)
              check_result(
                  expect_full_designs,
                  None,
                  rhs,
                  data,
                  expected_rhs_values,
                  expected_rhs_names,
                  expected_lhs_values,
                  expected_lhs_names,
              )
  
          # We inline assert_raises here to avoid complications with the
          # depth argument.
          for f in two_mat_fs:
              try:
                  f(formula_like, data, depth)
              except PatsyError:
                  pass
              else:
                  raise AssertionError
      else:
          for f in one_mat_fs:
              try:
                  f(formula_like, data, depth)
              except PatsyError:
                  pass
              else:
                  raise AssertionError
  
          for f in two_mat_fs:
              (lhs, rhs) = f(formula_like, data, depth)
              check_result(
                  expect_full_designs,
                  lhs,
                  rhs,
                  data,
                  expected_rhs_values,
                  expected_rhs_names,
                  expected_lhs_values,
                  expected_lhs_names,
              )
  
imports: import sys
  import __future__
  import six
  import numpy
  import pytest
  from patsy import PatsyError
  from patsy.design_info import DesignMatrix, DesignInfo
  from patsy.eval import EvalEnvironment
  from patsy.desc import ModelDesc, Term, INTERCEPT
  from patsy.categorical import C
  from patsy.contrasts import Helmert
  from patsy.user_util import balanced, LookupFactor
  from patsy.build import design_matrix_builders, build_design_matrices
  from patsy.highlevel import *
  from patsy.util import have_pandas, have_pandas_categorical, have_pandas_categorical_dtype, pandas_Categorical_from_codes
  from patsy.origin import Origin
label_desc: Use image node_id 4 for calling a global function with example usage: t(formula_like, data, depth, expect_full_designs, expected_rhs_values, expected_rhs_names, expected_lhs_values, expected_lhs_names) and returns: iter