code: def test_calculate_tr():
      """Test the TR calculation."""
      true_tr = 0.75
      n_vols = 4
  
      # create times for four volumes, shifted forward by half a TR
      # (as with fMRIPrep slice timing corrected data)
      frame_times = np.linspace(
          true_tr / 2, (n_vols * true_tr) + (true_tr / 2), n_vols + 1
      )
  
      estimated_tr = _calculate_tr(frame_times)
  
      assert_almost_equal(estimated_tr, true_tr, 2)
  
imports: import warnings
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal
  from nilearn.glm.first_level.hemodynamic_models import _calculate_tr, _hrf_kernel, _regressor_names, _resample_regressor, _sample_condition, compute_regressor, glover_dispersion_derivative, glover_hrf, glover_time_derivative, orthogonalize, spm_dispersion_derivative, spm_hrf, spm_time_derivative
label_desc: Use image node_id 22 for calling a global function with example usage: test_calculate_tr() without return types