code: def test_X():
      from brainiak.factoranalysis.htfa import HTFA
      import numpy as np
  
      n_voxel = 100
      n_tr = 20
      K = 5
      max_global_iter = 3
      max_local_iter = 3
      max_voxel = n_voxel
      max_tr = n_tr
  
      R = []
      n_subj = 2
      for s in np.arange(n_subj):
          R.append(np.random.randint(2, high=102, size=(n_voxel, 3)))
  
      htfa = HTFA(
          K,
          n_subj=n_subj,
          max_global_iter=max_global_iter,
          max_local_iter=max_local_iter,
          max_voxel=max_voxel,
          max_tr=max_tr,
      )
  
      X = np.random.rand(n_voxel, n_tr)
      # Check that does NOT run with wrong data type
      with pytest.raises(TypeError) as excinfo:
          htfa.fit(X, R=R)
      assert "Input data should be a list" in str(excinfo.value)
  
      X = []
      # Check that does NOT run with wrong array dimension
      with pytest.raises(ValueError) as excinfo:
          htfa.fit(X, R=R)
      assert "Need at leat one subject to train the model" in str(
          excinfo.value
      )
  
      X = []
      X.append([1, 2, 3])
      # Check that does NOT run with wrong array dimension
      with pytest.raises(TypeError) as excinfo:
          htfa.fit(X, R=R)
      assert "data should be an array" in str(excinfo.value)
  
      X = []
      X.append(np.random.rand(n_voxel))
      # Check that does NOT run with wrong array dimension
      with pytest.raises(TypeError) as excinfo:
          htfa.fit(X, R=R)
      assert "subject data should be 2D array" in str(excinfo.value)
  
      X = []
      for s in np.arange(n_subj):
          X.append(np.random.rand(n_voxel, n_tr))
      R = np.random.randint(2, high=102, size=(n_voxel, 3))
  
      # Check that does NOT run with wrong data type
      with pytest.raises(TypeError) as excinfo:
          htfa.fit(X, R=R)
      assert "Coordinates should be a list" in str(excinfo.value)
  
      R = []
      R.append([1, 2, 3])
      # Check that does NOT run with wrong data type
      with pytest.raises(TypeError) as excinfo:
          htfa.fit(X, R=R)
      assert "Each scanner coordinate matrix should be an array" in str(
          excinfo.value
      )
  
      R = []
      R.append(np.random.rand(n_voxel))
      # Check that does NOT run with wrong array dimension
      with pytest.raises(TypeError) as excinfo:
          htfa.fit(X, R=R)
      assert "Each scanner coordinate matrix should be 2D array" in str(
          excinfo.value
      )
  
      R = []
      for s in np.arange(n_subj):
          R.append(np.random.rand(n_voxel - 1, 3))
      # Check that does NOT run with wrong array dimension
      with pytest.raises(TypeError) as excinfo:
          htfa.fit(X, R=R)
      assert "n_voxel should be the same in X[idx] and R[idx]" in str(
          excinfo.value
      )
  
imports: import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_X() without return types