code: def test_set_whole_data(self):
      data = np.zeros(100)
      B = Buffer(data=data)
      B._glir.clear()
      B.set_data(data=data)
      glir_cmds = B._glir.clear()
      assert len(glir_cmds) == 2
      assert glir_cmds[0][0] == "SIZE"
      assert glir_cmds[1][0] == "DATA"
  
      # And sub data
      B.set_subdata(data[:50], 20)
      glir_cmds = B._glir.clear()
      assert len(glir_cmds) == 1
      assert glir_cmds[0][0] == "DATA"
      assert glir_cmds[0][2] == 20  # offset
  
      # And sub data
      B.set_subdata(data)
      glir_cmds = B._glir.clear()
      assert glir_cmds[-1][0] == "DATA"
  
      # Wrong ways to set subdata
      self.assertRaises(ValueError, B.set_subdata, data[:50], -1)  # neg
      self.assertRaises(ValueError, B.set_subdata, data, 10)
  
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 2 for calling the BufferTest obj's underlying member method code with example usage: obj.test_set_whole_data() without return types