code: def test_colormap():
      """Test named colormaps."""
      autumn = get_colormap("autumn")
      assert autumn.glsl_map != ""
      assert len(autumn[0.0]) == 1
      assert len(autumn[0.5]) == 1
      assert len(autumn[1.0]) == 1
      assert len(autumn[[0.0, 0.5, 1.0]]) == 3
      assert len(autumn[np.array([0.0, 0.5, 1.0])]) == 3
  
      fire = get_colormap("fire")
      assert_array_equal(fire[0].rgba, np.ones((1, 4)))
      assert_array_equal(fire[1].rgba, np.array([[1, 0, 0, 1]]))
  
      grays = get_colormap("grays")
      assert_array_equal(grays[0.5].rgb, np.ones((1, 3)) * 0.5)
  
      hot = get_colormap("hot")
      assert_allclose(hot[0].rgba, [[0, 0, 0, 1]], 1e-6, 1e-6)
      assert_allclose(
          hot[0.5].rgba, [[1, 0.52272022, 0, 1]], 1e-6, 1e-6
      )
      assert_allclose(hot[1.0].rgba, [[1, 1, 1, 1]], 1e-6, 1e-6)
  
      # Test the GLSL and Python mapping.
      for name in get_colormaps():
          colormap = get_colormap(name)
          Function(colormap.glsl_map)
          colors = colormap[np.linspace(-2.0, 2.0, 50)]
          assert colors.rgba.min() >= 0
          assert colors.rgba.max() <= 1
  
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 8 for calling a global function with example usage: test_colormap() without return types