code: def test_simple():
      data = balanced(a=2, b=2)
      x1 = data["x1"] = np.linspace(0, 1, len(data["a"]))
      x2 = data["x2"] = data["x1"] ** 2
  
      m = make_matrix(data, 2, [["a"]], column_names=["a[a1]", "a[a2]"])
      assert np.allclose(m, [[1, 0], [1, 0], [0, 1], [0, 1]])
  
      m = make_matrix(
          data, 2, [[], ["a"]], column_names=["Intercept", "a[T.a2]"]
      )
      assert np.allclose(m, [[1, 0], [1, 0], [1, 1], [1, 1]])
  
      m = make_matrix(
          data,
          4,
          [["a", "b"]],
          column_names=[
              "a[a1]:b[b1]",
              "a[a2]:b[b1]",
              "a[a1]:b[b2]",
              "a[a2]:b[b2]",
          ],
      )
      assert np.allclose(
          m, [[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]
      )
  
      m = make_matrix(
          data,
          4,
          [[], ["a"], ["b"], ["a", "b"]],
          column_names=[
              "Intercept",
              "a[T.a2]",
              "b[T.b2]",
              "a[T.a2]:b[T.b2]",
          ],
      )
      assert np.allclose(
          m, [[1, 0, 0, 0], [1, 0, 1, 0], [1, 1, 0, 0], [1, 1, 1, 1]]
      )
  
      m = make_matrix(
          data,
          4,
          [[], ["b"], ["a"], ["b", "a"]],
          column_names=[
              "Intercept",
              "b[T.b2]",
              "a[T.a2]",
              "b[T.b2]:a[T.a2]",
          ],
      )
      assert np.allclose(
          m, [[1, 0, 0, 0], [1, 1, 0, 0], [1, 0, 1, 0], [1, 1, 1, 1]]
      )
  
      m = make_matrix(
          data,
          4,
          [["a"], ["x1"], ["a", "x1"]],
          column_names=["a[a1]", "a[a2]", "x1", "a[T.a2]:x1"],
      )
      assert np.allclose(
          m,
          [
              [1, 0, x1[0], 0],
              [1, 0, x1[1], 0],
              [0, 1, x1[2], x1[2]],
              [0, 1, x1[3], x1[3]],
          ],
      )
  
      m = make_matrix(
          data,
          3,
          [["x1"], ["x2"], ["x2", "x1"]],
          column_names=["x1", "x2", "x2:x1"],
      )
      assert np.allclose(m, np.column_stack((x1, x2, x1 * x2)))
  
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 6 for calling a global function with example usage: test_simple() without return types