code: def test_identity_adjointness(rng, size=4):
      """Test adjointess between _graph_net_data_function and \
      _graph_net_adjoint_data_function, with identity design matrix."""
      # A mask full of ones
      mask = np.ones((size, size, size), dtype=bool)
  
      # But with some zeros
      mask[0:3, 0:3, 0:3] = 0
      adjoint_mask = np.array([mask for _ in range(mask.ndim)])
      n_samples = np.sum(mask)
      X = np.eye(n_samples)
      l1_ratio = 0.5
      for _ in range(10):
          x = rng.random(np.sum(mask))
          y = rng.random(n_samples + np.sum(mask) * mask.ndim)
          Axdoty = np.dot(
              _graph_net_data_function(X, x, mask, l1_ratio), y
          )
          xdotAty = np.dot(
              _graph_net_adjoint_data_function(
                  X, y, adjoint_mask, l1_ratio
              ),
              x,
          )
  
          assert_almost_equal(Axdoty, xdotAty)
  
imports: import numpy
  import pytest
  import scipy
  from nibabel import Nifti1Image
  from numpy.testing import assert_almost_equal
  from scipy import linalg
  from nilearn.decoding._objective_functions import divergence, gradient
  from nilearn.decoding.space_net import BaseSpaceNet
  from nilearn.decoding.space_net_solvers import _graph_net_adjoint_data_function, _graph_net_data_function, _logistic_data_loss_and_spatial_grad, _logistic_data_loss_and_spatial_grad_derivative, _logistic_derivative_lipschitz_constant, _squared_loss_and_spatial_grad, _squared_loss_and_spatial_grad_derivative, _squared_loss_derivative_lipschitz_constant, mfista
  from nilearn.decoding.tests._testing import create_graph_net_simulation_data
  from .test_same_api import to_niimgs
label_desc: Use image node_id 5 for calling a global function with example usage: test_identity_adjointness(rng, size) without return types