code: def test_functions():
      # rgb numbers
      assert (255, 0, 0) == ImageColor.getrgb("rgb(255,0,0)")
      assert (0, 255, 0) == ImageColor.getrgb("rgb(0,255,0)")
      assert (0, 0, 255) == ImageColor.getrgb("rgb(0,0,255)")
  
      # percents
      assert (255, 0, 0) == ImageColor.getrgb("rgb(100%,0%,0%)")
      assert (0, 255, 0) == ImageColor.getrgb("rgb(0%,100%,0%)")
      assert (0, 0, 255) == ImageColor.getrgb("rgb(0%,0%,100%)")
  
      # rgba numbers
      assert (255, 0, 0, 0) == ImageColor.getrgb("rgba(255,0,0,0)")
      assert (0, 255, 0, 0) == ImageColor.getrgb("rgba(0,255,0,0)")
      assert (0, 0, 255, 0) == ImageColor.getrgb("rgba(0,0,255,0)")
      assert (0, 0, 0, 255) == ImageColor.getrgb("rgba(0,0,0,255)")
  
      assert (255, 0, 0) == ImageColor.getrgb("hsl(0,100%,50%)")
      assert (255, 0, 0) == ImageColor.getrgb("hsl(360,100%,50%)")
      assert (0, 255, 255) == ImageColor.getrgb("hsl(180,100%,50%)")
  
      assert (255, 0, 0) == ImageColor.getrgb("hsv(0,100%,100%)")
      assert (255, 0, 0) == ImageColor.getrgb("hsv(360,100%,100%)")
      assert (0, 255, 255) == ImageColor.getrgb("hsv(180,100%,100%)")
  
      # alternate format
      assert ImageColor.getrgb("hsb(0,100%,50%)") == ImageColor.getrgb(
          "hsv(0,100%,50%)"
      )
  
      # floats
      assert (254, 3, 3) == ImageColor.getrgb("hsl(0.1,99.2%,50.3%)")
      assert (255, 0, 0) == ImageColor.getrgb("hsl(360.,100.0%,50%)")
  
      assert (253, 2, 2) == ImageColor.getrgb("hsv(0.1,99.2%,99.3%)")
      assert (255, 0, 0) == ImageColor.getrgb("hsv(360.,100.0%,100%)")
  
      # case insensitivity
      assert ImageColor.getrgb("RGB(255,0,0)") == ImageColor.getrgb(
          "rgb(255,0,0)"
      )
      assert ImageColor.getrgb("RGB(100%,0%,0%)") == ImageColor.getrgb(
          "rgb(100%,0%,0%)"
      )
      assert ImageColor.getrgb("RGBA(255,0,0,0)") == ImageColor.getrgb(
          "rgba(255,0,0,0)"
      )
      assert ImageColor.getrgb("HSL(0,100%,50%)") == ImageColor.getrgb(
          "hsl(0,100%,50%)"
      )
      assert ImageColor.getrgb("HSV(0,100%,50%)") == ImageColor.getrgb(
          "hsv(0,100%,50%)"
      )
      assert ImageColor.getrgb("HSB(0,100%,50%)") == ImageColor.getrgb(
          "hsb(0,100%,50%)"
      )
  
      # space agnosticism
      assert (255, 0, 0) == ImageColor.getrgb(
          "rgb(  255  ,  0  ,  0  )"
      )
      assert (255, 0, 0) == ImageColor.getrgb(
          "rgb(  100%  ,  0%  ,  0%  )"
      )
      assert (255, 0, 0, 0) == ImageColor.getrgb(
          "rgba(  255  ,  0  ,  0  ,  0  )"
      )
      assert (255, 0, 0) == ImageColor.getrgb(
          "hsl(  0  ,  100%  ,  50%  )"
      )
      assert (255, 0, 0) == ImageColor.getrgb(
          "hsv(  0  ,  100%  ,  100%  )"
      )
  
      # wrong number of components
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgb(255,0)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgb(255,0,0,0)")
  
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgb(100%,0%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgb(100%,0%,0)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgb(100%,0%,0 %)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgb(100%,0%,0%,0%)")
  
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgba(255,0,0)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("rgba(255,0,0,0,0)")
  
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsl(0,100%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsl(0,100%,0%,0%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsl(0%,100%,50%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsl(0,100,50%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsl(0,100%,50)")
  
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsv(0,100%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsv(0,100%,0%,0%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsv(0%,100%,50%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsv(0,100,50%)")
      with pytest.raises(ValueError):
          ImageColor.getrgb("hsv(0,100%,50)")
  
file_path: pillow/Tests/test_imagecolor.py
imports: from __future__ import annotations
  import pytest
  from PIL import Image, ImageColor
label_desc: Use image node_id 3 for calling a global function with example usage: test_functions() without return types