code: def test_linear_region_gradient():
      """Test LinearRegionVisual with a gradient as color"""
      # Definition of the region
      pos2 = [5, 42, 80]
      # Definition of the color of the region
      color2 = np.array(
          [
              [0.0, 1.0, 0.0, 0.5],
              [1.0, 0.0, 0.0, 0.75],
              [0.0, 0.0, 1.0, 1.0],
          ],
          dtype=np.float32,
      )
      # Expected internal color buffer
      color2_expected = np.array(
          [
              color2[0],
              color2[0],
              color2[1],
              color2[1],
              color2[2],
              color2[2],
          ],
          dtype=np.float32,
      )
  
      with TestingCanvas() as c:
          # Check set_data is working correctly within visual constructor
          region = visuals.LinearRegion(
              pos=pos2, color=color2, parent=c.scene
          )
          assert np.all(region._color == color2_expected)
          assert np.all(region.color == color2)
  
          assert_image_approved(
              c.render(), "visuals/linear_region2.png"
          )
  
file_path: vispy/vispy/visuals/tests/test_linear_region.py
imports: import numpy
  from vispy.scene import visuals
  from vispy.testing import requires_application, TestingCanvas, run_tests_if_main
  from vispy.testing.image_tester import assert_image_approved
  from vispy.testing import assert_raises
label_desc: Use image node_id 3 for calling a global function with example usage: test_linear_region_gradient() without return types