code: def test_getcolor():
      palette = ImagePalette.ImagePalette()
      assert len(palette.palette) == 0
      assert len(palette.colors) == 0
  
      test_map = {}
      for i in range(256):
          test_map[palette.getcolor((i, i, i))] = i
      assert len(test_map) == 256
  
      # Colors can be converted between RGB and RGBA
      rgba_palette = ImagePalette.ImagePalette("RGBA")
      assert rgba_palette.getcolor((0, 0, 0)) == rgba_palette.getcolor(
          (0, 0, 0, 255)
      )
  
      assert palette.getcolor((0, 0, 0)) == palette.getcolor(
          (0, 0, 0, 255)
      )
  
      # An error is raised when the palette is full
      with pytest.raises(ValueError):
          palette.getcolor((1, 2, 3))
      # But not if the image is not using one of the palette entries
      palette.getcolor((1, 2, 3), image=Image.new("P", (1, 1)))
  
      # Test unknown color specifier
      with pytest.raises(ValueError):
          palette.getcolor("unknown")
  
file_path: pillow-simd/Tests/test_imagepalette.py
imports: import pytest
  from PIL import Image, ImagePalette
  from .helper import assert_image_equal, assert_image_equal_tofile
label_desc: Use image node_id 3 for calling a global function with example usage: test_getcolor() without return types