code: def test_return_type():
      data = {"x": [1, 2, 3]}
  
      def iter_maker():
          yield data
  
      builder = design_matrix_builders(
          [make_termlist("x")], iter_maker, 0
      )[0]
  
      # Check explicitly passing return_type="matrix" works
      mat = build_design_matrices(
          [builder], data, return_type="matrix"
      )[0]
      assert isinstance(mat, DesignMatrix)
  
      # Check that nonsense is detected
      pytest.raises(
          PatsyError,
          build_design_matrices,
          [builder],
          data,
          return_type="asdfsadf",
      )
  
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 11 for calling a global function with example usage: test_return_type() without return types