code: def test_renderbuffer():
      # Set with no args
      assert_raises(ValueError, RenderBuffer)
  
      # Set shape only
      R = RenderBuffer((10, 20))
      assert R.shape == (10, 20)
      assert R.format is None
  
      # Set both shape and format
      R = RenderBuffer((10, 20), "color")
      assert R.shape == (10, 20)
      assert R.format == "color"
      #
      glir_cmds = R._glir.clear()
      assert len(glir_cmds) == 2
      assert glir_cmds[0][0] == "CREATE"
      assert glir_cmds[1][0] == "SIZE"
  
      # Orther formats
      assert RenderBuffer((10, 20), "depth").format == "depth"
      assert RenderBuffer((10, 20), "stencil").format == "stencil"
  
      # Test reset size and format
      R.resize((9, 9), "depth")
      assert R.shape == (9, 9)
      assert R.format == "depth"
      R.resize((8, 8), "stencil")
      assert R.shape == (8, 8)
      assert R.format == "stencil"
  
      # Wrong formats
      assert_raises(ValueError, R.resize, (9, 9), "no_format")
      assert_raises(ValueError, R.resize, (9, 9), [])
  
      # Resizable
      R = RenderBuffer((10, 20), "color", False)
      assert_raises(RuntimeError, R.resize, (9, 9), "color")
  
      # Attaching sets the format
      F = FrameBuffer()
      #
      R = RenderBuffer((9, 9))
      F.color_buffer = R
      assert F.color_buffer is R
      assert R.format == "color"
      #
      F.depth_buffer = RenderBuffer((9, 9))
      assert F.depth_buffer.format == "depth"
      #
      F.stencil_buffer = RenderBuffer((9, 9))
      assert F.stencil_buffer.format == "stencil"
  
imports: from vispy.testing import run_tests_if_main, assert_raises
  from vispy import gloo
  from vispy.gloo import FrameBuffer, RenderBuffer
label_desc: Use image node_id 1 for calling a global function with example usage: test_renderbuffer() without return types