code: def test_givens_rotate(shape, indices, row, left):
      r"""Test that Givens rotation is performed correctly for matrices built via `_givens_matrix`."""
      matrix = np.random.rand(*shape) * 1j + np.random.rand(*shape)
      unitary, (i, j) = matrix.copy(), indices
      if row:
          a, b = matrix[indices, j - 1]
          grot_mat = _givens_matrix(a, b, left)
          unitary[indices] = grot_mat @ unitary[indices]
          res = (
              b / np.abs(b) * np.hypot(np.abs(a), np.abs(b))
              if b
              else 1.0
          )
          if left:
              assert np.isclose(unitary[i, j - 1], 0.0) and np.isclose(
                  unitary[j, j - 1], res
              )
          else:
              assert np.isclose(unitary[i, j - 1], res) and np.isclose(
                  unitary[j, j - 1], 0.0
              )
      else:
          a, b = matrix[j - 1, indices].T
          grot_mat = _givens_matrix(a, b, left)
          unitary[:, indices] = unitary[:, indices] @ grot_mat.T
          res = (
              b / np.abs(b) * np.hypot(np.abs(a), np.abs(b))
              if b
              else 1.0
          )
          if left:
              assert np.isclose(unitary[j - 1, i], 0.0) and np.isclose(
                  unitary[j - 1, j], res
              )
          else:
              assert np.isclose(
                  unitary[j - 1, indices[0]], res
              ) and np.isclose(unitary[j - 1, indices[1]], 0.0)
  
imports: import pytest
  from scipy.stats import unitary_group
  from pennylane import numpy
  from pennylane.qchem.givens_decomposition import _givens_matrix, givens_decomposition
label_desc: Use image node_id 2 for calling a global function with example usage: test_givens_rotate(shape, indices, row, left) without return types