code: def test_resampling_copy_has_no_shared_memory(target_shape):
      """copy=true guarantees output array shares no memory with input array."""
      img, affine, _ = _make_resampling_test_data()
      target_affine = None if target_shape is None else affine
  
      img_r = resample_img(
          img,
          target_affine=target_affine,
          target_shape=target_shape,
          copy=False,
      )
  
      assert img_r == img
  
      img_r = resample_img(
          img,
          target_affine=target_affine,
          target_shape=target_shape,
          copy=True,
      )
  
      assert not np.may_share_memory(get_data(img_r), get_data(img))
      assert_almost_equal(get_data(img_r), get_data(img))
      assert_almost_equal(img_r.affine, img.affine)
  
imports: import copy
  import math
  import os
  from pathlib import Path
  import numpy
  import pytest
  from nibabel import Nifti1Header, Nifti1Image
  from nibabel.freesurfer import MGHImage
  from numpy.testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, assert_equal
  from nilearn import _utils
  from nilearn._utils import testing
  from nilearn.conftest import _affine_eye, _rng
  from nilearn.image import get_data
  from nilearn.image.image import _pad_array, crop_img
  from nilearn.image.resampling import BoundingBoxError, coord_transform, from_matrix_vector, get_bounds, reorder_img, resample_img, resample_to_img
label_desc: Use image node_id 12 for calling a global function with example usage: test_resampling_copy_has_no_shared_memory(target_shape) without return types