code: def test_alpha_inplace(self):
      src = Image.new("RGBA", (128, 128), "blue")
  
      over = Image.new("RGBA", (128, 128), "red")
      mask = hopper("L")
      over.putalpha(mask)
  
      target = Image.alpha_composite(src, over)
  
      # basic
      full = src.copy()
      full.alpha_composite(over)
      assert_image_equal(full, target)
  
      # with offset down to right
      offset = src.copy()
      offset.alpha_composite(over, (64, 64))
      assert_image_equal(
          offset.crop((64, 64, 127, 127)), target.crop((0, 0, 63, 63))
      )
      assert offset.size == (128, 128)
  
      # with negative offset
      offset = src.copy()
      offset.alpha_composite(over, (-64, -64))
      assert_image_equal(
          offset.crop((0, 0, 63, 63)), target.crop((64, 64, 127, 127))
      )
      assert offset.size == (128, 128)
  
      # offset and crop
      box = src.copy()
      box.alpha_composite(over, (64, 64), (0, 0, 32, 32))
      assert_image_equal(
          box.crop((64, 64, 96, 96)), target.crop((0, 0, 32, 32))
      )
      assert_image_equal(
          box.crop((96, 96, 128, 128)), src.crop((0, 0, 32, 32))
      )
      assert box.size == (128, 128)
  
      # source point
      source = src.copy()
      source.alpha_composite(over, (32, 32), (32, 32, 96, 96))
  
      assert_image_equal(
          source.crop((32, 32, 96, 96)), target.crop((32, 32, 96, 96))
      )
      assert source.size == (128, 128)
  
      # errors
      with pytest.raises(ValueError):
          source.alpha_composite(over, "invalid source")
      with pytest.raises(ValueError):
          source.alpha_composite(over, (0, 0), "invalid destination")
      with pytest.raises(ValueError):
          source.alpha_composite(over, 0)
      with pytest.raises(ValueError):
          source.alpha_composite(over, (0, 0), 0)
      with pytest.raises(ValueError):
          source.alpha_composite(over, (0, 0), (0, -1))
  
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 26 for calling the TestImage obj's underlying member method code with example usage: obj.test_alpha_inplace() without return types