class_docstr: Tests for the _sparse_expand_matrix function.
class_docstr_tok: ["Tests","for","the","_sparse_expand_matrix","function","."]
docstr: Test that if the indices are the same then the identity is returned.
docstr_tok: ["Test","that","if","the","indices","are","the","same","then","the","identity","is","returned","."]
code: def test_sparse_swap_mat_same_index(self):
      """Test that if the indices are the same then the identity is returned."""
      # pylint: disable=protected-access
      computed_mat = qml.math.matrix_manipulation._sparse_swap_mat(
          2, 2, 3
      ).toarray()
      expected_mat = np.eye(8)
      assert np.allclose(expected_mat, computed_mat)
  
imports: from functools import reduce
  import numpy
  import pytest
  from gate_data import CNOT, II, SWAP, I, Toffoli
  from scipy.sparse import csr_matrix
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 13 for calling the TestExpandMatrixSparse obj's underlying member method code with example usage: obj.test_sparse_swap_mat_same_index() without return types