class_docstr: Tests the continuous variable based operations.
docstr: ops: Tests the Heisenberg representation of the Displacement gate.
docstr_tok: ["ops",":","Tests","the","Heisenberg","representation","of","the","Displacement","gate","."]
code: def test_displacement_heisenberg(self, phi, mag):
      """ops: Tests the Heisenberg representation of the Displacement gate."""
      r = mag
      hbar = 2
      matrix = cv.Displacement._heisenberg_rep([r, phi])
      true_matrix = np.array(
          [
              [1, 0, 0],
              [np.sqrt(2 * hbar) * r * np.cos(phi), 1, 0],
              [np.sqrt(2 * hbar) * r * np.sin(phi), 0, 1],
          ]
      )
      assert np.allclose(matrix, true_matrix)
  
imports: import pytest
  import numpy.testing
  from pennylane import numpy
  from pennylane.operation import AnyWires
  from pennylane.ops import cv
  from pennylane.wires import Wires
label_desc: Use image node_id 5 for calling the TestCV obj's underlying member method code with example usage: obj.test_displacement_heisenberg(phi, mag) without return types