code: def test_matrix_plotting_reorder(mat, labels):
      from itertools import permutations
  
      # test if reordering with default linkage works
      idx = [2, 3, 5]
      # make symmetric matrix of similarities so we can get a block
      for perm in permutations(idx, 2):
          mat[perm] = 1
      ax = plot_matrix(mat, labels=labels, reorder=True)
      assert len(labels) == len(ax.axes.get_xticklabels())
      reordered_labels = [
          int(lbl.get_text()) for lbl in ax.axes.get_xticklabels()
      ]
      # block order does not matter
      assert (
          reordered_labels[:3] == idx or reordered_labels[-3:] == idx
      ), "Clustering does not find block structure."
      plt.close()
      # test if reordering with specific linkage works
      ax = plot_matrix(mat, labels=labels, reorder="complete")
      plt.close()
  
imports: import matplotlib
  import matplotlib.pyplot
  import numpy
  import pandas
  import pytest
  from numpy.testing import assert_array_equal
  from nilearn.glm.first_level.design_matrix import make_first_level_design_matrix
  from nilearn.glm.tests._testing import design_with_null_durations
  from nilearn.plotting.matrix_plotting import pad_contrast_matrix, plot_contrast_matrix, plot_design_matrix, plot_event, plot_matrix
label_desc: Use image node_id 15 for calling a global function with example usage: test_matrix_plotting_reorder(mat, labels) without return types