code: def test_linear_gradient(self):
      # Arrange
      target_file = "Tests/images/linear_gradient.png"
      for mode in ["L", "P", "I", "F"]:
          # Act
          im = Image.linear_gradient(mode)
  
          # Assert
          assert im.size == (256, 256)
          assert im.mode == mode
          assert im.getpixel((0, 0)) == 0
          assert im.getpixel((255, 255)) == 255
          with Image.open(target_file) as target:
              target = target.convert(mode)
          assert_image_equal(im, target)
  
imports: import io
  import os
  import shutil
  import sys
  import tempfile
  import pytest
  from PIL import Image, ImageDraw, ImagePalette, UnidentifiedImageError
  from .helper import assert_image_equal, assert_image_equal_tofile, assert_image_similar_tofile, assert_not_all_same, hopper, is_win32, mark_if_feature_version, skip_unless_feature
label_desc: Use image node_id 38 for calling the TestImage obj's underlying member method code with example usage: obj.test_linear_gradient() without return types