code: def test_colormap_gradient():
      """Test gradient colormaps."""
      cm = Colormap(["r", "g"])
      assert_allclose(cm[-1].rgba, [[1, 0, 0, 1]])
      assert_allclose(cm[0.0].rgba, [[1, 0, 0, 1]])
      assert_allclose(cm[0.5].rgba, [[0.5, 0.5, 0, 1]])
      assert_allclose(cm[1.0].rgba, [[0, 1, 0, 1]])
  
      cm = Colormap(["r", "g", "b"])
      assert_allclose(cm[-1].rgba, [[1, 0, 0, 1]])
      assert_allclose(cm[0.0].rgba, [[1, 0, 0, 1]])
      assert_allclose(cm[0.5].rgba, [[0, 1, 0, 1]])
      assert_allclose(cm[1].rgba, [[0, 0, 1, 1]])
      assert_allclose(cm[2].rgba, [[0, 0, 1, 1]])
  
      cm = Colormap(["r", "g", "b"], [0.0, 0.1, 1.0])
      assert_allclose(cm[-1].rgba, [[1, 0, 0, 1]])
      assert_allclose(cm[0.0].rgba, [[1, 0, 0, 1]])
      assert_allclose(cm[0.1].rgba, [[0, 1, 0, 1]])
      assert_allclose(cm[1].rgba, [[0, 0, 1, 1]], 1e-6, 1e-6)
      assert_allclose(cm[2].rgba, [[0, 0, 1, 1]], 1e-6, 1e-6)
  
file_path: vispy/vispy/color/tests/test_color.py
imports: import numpy
  from numpy.testing import assert_array_equal, assert_allclose
  from vispy.color import Color, ColorArray, get_color_names, Colormap, get_color_dict, get_colormap, get_colormaps
  from vispy.visuals.shaders import Function
  from vispy.util import use_log_level
  from vispy.testing import run_tests_if_main, assert_equal, assert_raises, assert_true
label_desc: Use image node_id 6 for calling a global function with example usage: test_colormap_gradient() without return types