code: def test_resampling_with_affine():
      """Test resampling with a given rotation part of the affine."""
      prng = np.random.RandomState(10)
      data = prng.randint(4, size=(1, 4, 4))
      img = VolumeImg(data, np.eye(4), "mine", interpolation="nearest")
      for angle in (0, np.pi, np.pi / 2, np.pi / 4, np.pi / 3):
          rot = rotation(0, angle)
          rot_im = img.as_volume_img(affine=rot)
          assert_almost_equal(np.max(data), np.max(rot_im.get_fdata()))
  
imports: import copy
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  from ...transforms.affine_transform import AffineTransform
  from ...transforms.affine_utils import from_matrix_vector
  from ...transforms.transform import Transform
  from ..volume_img import CompositionError, VolumeImg
label_desc: Use image node_id 6 for calling a global function with example usage: test_resampling_with_affine() without return types