code: def test_data_types():
      basic_dict = {"a": ["a1", "a2", "a1", "a2"], "x": [1, 2, 3, 4]}
      # On Python 2, this is identical to basic_dict:
      basic_dict_bytes = dict(basic_dict)
      basic_dict_bytes["a"] = [
          s.encode("ascii") for s in basic_dict_bytes["a"]
      ]
      # On Python 3, this is identical to basic_dict:
      basic_dict_unicode = {
          "a": ["a1", "a2", "a1", "a2"],
          "x": [1, 2, 3, 4],
      }
      basic_dict_unicode = dict(basic_dict)
      basic_dict_unicode["a"] = [
          six.text_type(s) for s in basic_dict_unicode["a"]
      ]
  
      structured_array_bytes = np.array(
          list(zip(basic_dict["a"], basic_dict["x"])),
          dtype=[("a", "S2"), ("x", int)],
      )
      structured_array_unicode = np.array(
          list(zip(basic_dict["a"], basic_dict["x"])),
          dtype=[("a", "U2"), ("x", int)],
      )
      recarray_bytes = structured_array_bytes.view(np.recarray)
      recarray_unicode = structured_array_unicode.view(np.recarray)
      datas = [
          basic_dict,
          structured_array_bytes,
          structured_array_unicode,
          recarray_bytes,
          recarray_unicode,
      ]
      if have_pandas:
          df_bytes = pandas.DataFrame(basic_dict_bytes)
          datas.append(df_bytes)
          df_unicode = pandas.DataFrame(basic_dict_unicode)
          datas.append(df_unicode)
      for data in datas:
          m = make_matrix(
              data,
              4,
              [["a"], ["a", "x"]],
              column_names=["a[a1]", "a[a2]", "a[a1]:x", "a[a2]:x"],
          )
          assert np.allclose(
              m,
              [[1, 0, 1, 0], [0, 1, 0, 2], [1, 0, 3, 0], [0, 1, 0, 4]],
          )
  
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 9 for calling a global function with example usage: test_data_types() without return types