code: def test_eq():
      """Test copy and equality for VolumeImgs."""
      import copy
  
      shape = (4, 3, 5, 2)
      data = np.random.random(shape)
      affine = np.random.random((4, 4))
      ref_im = VolumeImg(data, affine, "mine")
      assert ref_im == ref_im
      assert ref_im == copy.copy(ref_im)
      assert ref_im == copy.deepcopy(ref_im)
      # Check that as_volume_img with no arguments returns the same image
      assert ref_im == ref_im.as_volume_img()
      copy_im = copy.copy(ref_im)
      copy_im.get_fdata()[0, 0, 0] *= -1
      assert ref_im != copy_im
      copy_im = copy.copy(ref_im)
      copy_im.affine[0, 0] *= -1
      assert ref_im != copy_im
      copy_im = copy.copy(ref_im)
      copy_im.world_space = "other"
      assert ref_im != copy_im
      # Test repr
      assert isinstance(repr(ref_im), str)
      # Test init: should raise exception is not passing in right affine
      pytest.raises(Exception, VolumeImg, data, np.eye(3, 3), "mine")
  
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 8 for calling a global function with example usage: test_eq() without return types