code: def test_categorical():
      data_strings = {"a": ["a1", "a2", "a1"]}
      data_categ = {"a": C(["a2", "a1", "a2"])}
      datas = [data_strings, data_categ]
      if have_pandas_categorical:
          data_pandas = {"a": pandas.Categorical(["a1", "a2", "a2"])}
          datas.append(data_pandas)
  
      def t(data1, data2):
          def iter_maker():
              yield data1
  
          builders = design_matrix_builders(
              [make_termlist(["a"])], iter_maker, eval_env=0
          )
          build_design_matrices(builders, data2)
  
      for data1 in datas:
          for data2 in datas:
              t(data1, data2)
  
imports: from __future__ import print_function
  import six
  import numpy
  import pytest
  from patsy import PatsyError
  from patsy.util import atleast_2d_column_default, have_pandas, have_pandas_categorical
  from patsy.desc import Term, INTERCEPT
  from patsy.build import *
  from patsy.categorical import C
  from patsy.user_util import balanced, LookupFactor
  from patsy.design_info import DesignMatrix, DesignInfo
label_desc: Use image node_id 19 for calling a global function with example usage: test_categorical() without return types