code: def test_structure_format_mixed(self):
      dt = np.dtype(
          [("name", np.str_, 16), ("grades", np.float64, (2,))]
      )
      x = np.array(
          [("Sarah", (8.0, 7.0)), ("John", (6.0, 7.0))], dtype=dt
      )
      assert_equal(
          np.array2string(x), "[('Sarah', [8., 7.]) ('John', [6., 7.])]"
      )
  
      np.set_printoptions(legacy="1.13")
      try:
          # for issue #5692
          A = np.zeros(shape=10, dtype=[("A", "M8[s]")])
          A[5:].fill(np.datetime64("NaT"))
          assert_equal(
              np.array2string(A),
              textwrap.dedent(
                  """\
                  [('1970-01-01T00:00:00',) ('1970-01-01T00:00:00',) ('1970-01-01T00:00:00',)
                   ('1970-01-01T00:00:00',) ('1970-01-01T00:00:00',) ('NaT',) ('NaT',)
                   ('NaT',) ('NaT',) ('NaT',)]"""
              ),
          )
      finally:
          np.set_printoptions(legacy=False)
  
      # same again, but with non-legacy behavior
      assert_equal(
          np.array2string(A),
          textwrap.dedent(
              """\
              [('1970-01-01T00:00:00',) ('1970-01-01T00:00:00',)
               ('1970-01-01T00:00:00',) ('1970-01-01T00:00:00',)
               ('1970-01-01T00:00:00',) (                'NaT',)
               (                'NaT',) (                'NaT',)
               (                'NaT',) (                'NaT',)]"""
          ),
      )
  
      # and again, with timedeltas
      A = np.full(10, 123456, dtype=[("A", "m8[s]")])
      A[5:].fill(np.datetime64("NaT"))
      assert_equal(
          np.array2string(A),
          textwrap.dedent(
              """\
              [(123456,) (123456,) (123456,) (123456,) (123456,) ( 'NaT',) ( 'NaT',)
               ( 'NaT',) ( 'NaT',) ( 'NaT',)]"""
          ),
      )
  
imports: import sys
  import gc
  from hypothesis import given
  from hypothesis.extra import numpy
  import pytest
  import numpy
  from numpy.testing import assert_, assert_equal, assert_raises, assert_warns, HAS_REFCOUNT, assert_raises_regex
  from numpy.core.arrayprint import _typelessdata
  import textwrap
label_desc: Use image node_id 4 for calling the TestArray2String obj's underlying member method code with example usage: obj.test_structure_format_mixed() without return types