code: def test_make_recarray():
      # Test make_array
      # From list / sequence
      # 2D case
      data_2d = [(3, 4), (4, 6), (7, 9)]
      m = F.make_recarray(data_2d, "wv", [np.float64, np.int_])
      assert_starr_equal(
          m, fromrecords(data_2d, dtype=[("w", float), ("v", int)])
      )
      # 1D vector, sequence and array
      for data_1d in (range(4), np.arange(4).astype(float)):
          # Column vector. For array case, drop name dim for shape match
          assert_starr_equal(
              F.make_recarray(data_1d, ["f1"], drop_name_dim=True),
              np.arange(4).astype([("f1", float)]),
          )
          # Row vector. Drop name dim for shape match
          assert_starr_equal(
              F.make_recarray(data_1d, "abcd", drop_name_dim=True),
              np.array(
                  tuple(range(4)), dtype=[(c, float) for c in "abcd"]
              ),
          )
      # From another recarray, reaming fields
      m2 = F.make_recarray(m, "xy")
      assert_starr_equal(
          m2, fromrecords(data_2d, dtype=[("x", float), ("y", int)])
      )
      # Recarrays don't change shape, trailing dimensions or no
      assert_starr_equal(F.make_recarray(m2, "xy"), m2)
      m2_dash = np.reshape(m2, (3, 1, 1, 1))
      assert_starr_equal(F.make_recarray(m2_dash, "xy"), m2_dash)
      # From an array, drop dim case
      arr = np.array(data_2d)
      assert arr.shape == (3, 2)
      assert_starr_equal(
          F.make_recarray(arr, "xy", drop_name_dim=True),
          fromrecords(data_2d, dtype=[("x", int), ("y", int)]),
      )
      assert_starr_equal(
          F.make_recarray(arr.astype(float), "xy", drop_name_dim=True),
          fromrecords(data_2d, dtype=[("x", float), ("y", float)]),
      )
      assert_starr_equal(
          F.make_recarray(
              arr.reshape((3, 1, 2)), "xy", drop_name_dim=True
          ),
          fromrecords(data_2d, dtype=[("x", int), ("y", int)]).reshape(
              (3, 1)
          ),
      )
      # Not drop dim case, trailing length 1 axis.
      assert_starr_equal(
          F.make_recarray(arr, "xy", drop_name_dim=False),
          fromrecords(data_2d, dtype=[("x", int), ("y", int)]).reshape(
              (3, 1)
          ),
      )
      assert_starr_equal(
          F.make_recarray(
              arr.reshape((3, 1, 2)), "xy", drop_name_dim=False
          ),
          fromrecords(data_2d, dtype=[("x", int), ("y", int)]).reshape(
              (3, 1, 1)
          ),
      )
      # False case is the default, with warning (for now)
      with catch_warnings(record=True) as warn_list:
          # Clear any pre-existing warnings cached in formula module, to make
          # sure warning is triggered..  See
          # nibabel.testing.clear_and_catch_warnings for detail.
          if hasattr(F, "__warningregistry__"):
              F.__warningregistry__.clear()
          simplefilter("always")
          assert_starr_equal(
              F.make_recarray(arr, "xy"),
              fromrecords(
                  data_2d, dtype=[("x", int), ("y", int)]
              ).reshape((3, 1)),
          )
          assert warn_list[0].category == VisibleDeprecationWarning
      # Can't pass dtypes to array version of function
      pytest.raises(
          ValueError, F.make_recarray, arr, "xy", [int, float]
      )
  
imports: from warnings import catch_warnings, simplefilter
  import numpy
  import pytest
  import sympy
  from numpy.core.records import fromrecords
  from numpy.testing import assert_almost_equal, assert_array_equal
  from sympy.utilities.lambdify import implemented_function
  from nipy.utils import VisibleDeprecationWarning
  from ..None import formulae
  from ..formulae import Term, terms
label_desc: Use image node_id 13 for calling a global function with example usage: test_make_recarray() without return types