code: def test_void_scalar_structured_data(self):
      dt = np.dtype(
          [("name", np.str_, 16), ("grades", np.float64, (2,))]
      )
      x = np.array(("ndarray_scalar", (1.2, 3.0)), dtype=dt)[()]
      assert_(isinstance(x, np.void))
      mv_x = memoryview(x)
      expected_size = 16 * np.dtype((np.str_, 1)).itemsize
      expected_size += 2 * np.dtype(np.float64).itemsize
      assert_equal(mv_x.itemsize, expected_size)
      assert_equal(mv_x.ndim, 0)
      assert_equal(mv_x.shape, ())
      assert_equal(mv_x.strides, ())
      assert_equal(mv_x.suboffsets, ())
  
      # check scalar format string against ndarray format string
      a = np.array(
          [("Sarah", (8.0, 7.0)), ("John", (6.0, 7.0))], dtype=dt
      )
      assert_(isinstance(a, np.ndarray))
      mv_a = memoryview(a)
      assert_equal(mv_x.itemsize, mv_a.itemsize)
      assert_equal(mv_x.format, mv_a.format)
  
      # Check that we do not allow writeable buffer export (technically
      # we could allow it sometimes here...)
      with pytest.raises(
          BufferError, match="scalar buffer is readonly"
      ):
          get_buffer_info(x, ["WRITABLE"])
  
file_path: numpy/numpy/_core/tests/test_scalarbuffer.py
imports: import numpy
  from numpy._core._rational_tests import rational
  from numpy._core._multiarray_tests import get_buffer_info
  import pytest
  from numpy.testing import assert_, assert_equal, assert_raises
label_desc: Use image node_id 5 for calling the TestScalarPEP3118 obj's underlying member method code with example usage: obj.test_void_scalar_structured_data() without return types