code: def _test_rotate(self, deg, transpose):
      im = self._test_image()
  
      angle = -math.radians(deg)
      matrix = [
          round(math.cos(angle), 15),
          round(math.sin(angle), 15),
          0.0,
          round(-math.sin(angle), 15),
          round(math.cos(angle), 15),
          0.0,
          0,
          0,
      ]
      matrix[2] = (1 - matrix[0] - matrix[1]) * im.width / 2
      matrix[5] = (1 - matrix[3] - matrix[4]) * im.height / 2
  
      if transpose is not None:
          transposed = im.transpose(transpose)
      else:
          transposed = im
  
      for resample in [Image.NEAREST, Image.BILINEAR, Image.BICUBIC]:
          transformed = im.transform(
              transposed.size, self.transform, matrix, resample
          )
          assert_image_equal(transposed, transformed)
  
imports: import math
  import pytest
  from PIL import Image, ImageTransform
  from .helper import assert_image_equal, assert_image_similar, hopper
label_desc: Use image node_id 2 for calling the TestImageTransformAffine obj's underlying member method code with example usage: obj._test_rotate(deg, transpose) without return types