code: def test_data_types():
      data = {
          "a": [1, 2, 3],
          "b": [1.0, 2.0, 3.0],
          "c": np.asarray([1, 2, 3], dtype=np.float32),
          "d": [True, False, True],
          "e": ["foo", "bar", "baz"],
          "f": C([1, 2, 3]),
          "g": C(["foo", "bar", "baz"]),
          "h": np.array(["foo", 1, (1, "hi")], dtype=object),
      }
      t("~ 0 + a", data, 0, True, [[1], [2], [3]], ["a"])
      t("~ 0 + b", data, 0, True, [[1], [2], [3]], ["b"])
      t("~ 0 + c", data, 0, True, [[1], [2], [3]], ["c"])
      t(
          "~ 0 + d",
          data,
          0,
          True,
          [[0, 1], [1, 0], [0, 1]],
          ["d[False]", "d[True]"],
      )
      t(
          "~ 0 + e",
          data,
          0,
          True,
          [[0, 0, 1], [1, 0, 0], [0, 1, 0]],
          ["e[bar]", "e[baz]", "e[foo]"],
      )
      t(
          "~ 0 + f",
          data,
          0,
          True,
          [[1, 0, 0], [0, 1, 0], [0, 0, 1]],
          ["f[1]", "f[2]", "f[3]"],
      )
      t(
          "~ 0 + g",
          data,
          0,
          True,
          [[0, 0, 1], [1, 0, 0], [0, 1, 0]],
          ["g[bar]", "g[baz]", "g[foo]"],
      )
      # This depends on Python's sorting behavior:
      t(
          "~ 0 + h",
          data,
          0,
          True,
          [[0, 1, 0], [1, 0, 0], [0, 0, 1]],
          ["h[1]", "h[foo]", "h[(1, 'hi')]"],
      )
  
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 9 for calling a global function with example usage: test_data_types() without return types