code: def test_init_allowed_dtype(self):
      for dtype in (np.uint8, np.int8, np.uint16, np.int16, np.float32):
          V = VertexBuffer(np.zeros((10, 3), dtype=dtype))
          names = V.dtype.names
          assert V.dtype[names[0]].base == dtype
          assert V.dtype[names[0]].shape == (3,)
      for dtype in (np.float64, np.int64):
          self.assertRaises(
              TypeError, VertexBuffer, np.zeros((10, 3), dtype=dtype)
          )
  
      # Tuple/list is also allowed
      V = VertexBuffer([1, 2, 3])
      assert V.size == 3
      assert V.itemsize == 4
      #
      V = VertexBuffer([[1, 2], [3, 4], [5, 6]])
      assert V.size == 3
      assert V.itemsize == 2 * 4
  
      # Convert
      data = np.zeros((10,), "uint8")
      B = VertexBuffer(data)
      assert B.dtype[0].base == np.uint8
      assert B.dtype[0].itemsize == 1
      #
      data = np.zeros((10, 2), "uint8")
      B = VertexBuffer(data)
      assert B.dtype[0].base == np.uint8
      assert B.dtype[0].itemsize == 2
      B.set_data(data, convert=True)
      assert B.dtype[0].base == np.float32
      assert B.dtype[0].itemsize == 8
      B = VertexBuffer(data[::2].copy())
  
      # This is converted to 1D
      B = VertexBuffer([[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]])
      assert B.size == 10
  
      # Not allowed
      self.assertRaises(TypeError, VertexBuffer, dtype=np.float64)
  
imports: import unittest
  import numpy
  from vispy.testing import run_tests_if_main
  from vispy.gloo.buffer import Buffer, DataBuffer, DataBufferView, VertexBuffer, IndexBuffer
label_desc: Use image node_id 1 for calling the VertexBufferTest obj's underlying member method code with example usage: obj.test_init_allowed_dtype() without return types