code: def test_getdata():
      # Test getheader/getdata against legacy values.
      # Create a 'P' image with holes in the palette.
      im = Image._wedge().resize((16, 16), Image.NEAREST)
      im.putpalette(ImagePalette.ImagePalette("RGB"))
      im.info = {"background": 0}
  
      passed_palette = bytes(255 - i // 3 for i in range(768))
  
      GifImagePlugin._FORCE_OPTIMIZE = True
      try:
          h = GifImagePlugin.getheader(im, passed_palette)
          d = GifImagePlugin.getdata(im)
  
          import pickle
  
          # Enable to get target values on pre-refactor version
          # with open('Tests/images/gif_header_data.pkl', 'wb') as f:
          #    pickle.dump((h, d), f, 1)
          with open("Tests/images/gif_header_data.pkl", "rb") as f:
              (h_target, d_target) = pickle.load(f)
  
          assert h == h_target
          assert d == d_target
      finally:
          GifImagePlugin._FORCE_OPTIMIZE = False
  
imports: from io import BytesIO
  import pytest
  from PIL import GifImagePlugin, Image, ImageDraw, ImagePalette, features
  from .helper import assert_image_equal, assert_image_equal_tofile, assert_image_similar, hopper, is_pypy, netpbm_available
label_desc: Use image node_id 57 for calling a global function with example usage: test_getdata() without return types