class_docstr: Gate tests.
class_docstr_tok: ["Gate","tests","."]
docstr: Test the Fourier transform of a displaced state.
docstr_tok: ["Test","the","Fourier","transform","of","a","displaced","state","."]
code: def test_rotation(self, tol):
      """Test the Fourier transform of a displaced state."""
      # pylint: disable=invalid-unary-operand-type
  
      alpha = 0.23 + 0.12j
      S = rotation(np.pi / 2)
  
      # apply to a coherent state. F{x, p} -> {-p, x}
      out = S @ np.array([alpha.real, alpha.imag]) * np.sqrt(2 * hbar)
      expected = np.array([-alpha.imag, alpha.real]) * np.sqrt(2 * hbar)
      assert out == pytest.approx(expected, abs=tol)
  
imports: import numpy
  import numpy.random
  import pytest
  from scipy.linalg import block_diag
  from scipy.special import factorial
  import pennylane
  from pennylane import DeviceError
  from pennylane.devices.default_gaussian import fock_prob, rotation, squeezing, quadratic_phase, beamsplitter, two_mode_squeezing, controlled_addition, controlled_phase, vacuum_state, coherent_state, squeezed_state, displaced_squeezed_state, thermal_state
  from pennylane.wires import Wires
label_desc: Use image node_id 2 for calling the TestGates obj's underlying member method code with example usage: obj.test_rotation(tol) without return types