class_docstr: Tests that the template defines the correct sign flip.
class_docstr_tok: ["Tests","that","the","template","defines","the","correct","sign","flip","."]
code: def test_eval(self, n_status, n_wires):
      if isinstance(n_wires, int):
          n_wires = 1 if n_wires == 0 else n_wires
          n_wires = list(range(n_wires))
  
      dev = qml.device("default.qubit", wires=n_wires)
  
      @qml.qnode(dev)
      def circuit():
          for wire in n_wires:
              qml.Hadamard(wires=wire)
  
          qml.FlipSign(n_status, wires=n_wires)
  
          return qml.state()
  
      def to_number(status):
          return sum(
              status[i] * 2 ** (len(status) - i - 1)
              for i in range(len(status))
          )
  
      if isinstance(n_status, list):
          n_status = to_number(n_status)
  
      # we check that only the indicated value has been changed
      statuses = []
      for ind, x in enumerate(circuit()):
          if ind == n_status:
              statuses.append(bool(np.sign(x) == -1))
          else:
              statuses.append(bool(np.sign(x) == 1))
  
      assert np.all(np.array(statuses))
  
file_path: pennylane/tests/templates/test_subroutines/test_flip_sign.py
imports: import pytest
  from pennylane import numpy
  import pennylane
label_desc: Use image node_id 1 for calling the TestFlipSign obj's underlying member method code with example usage: obj.test_eval(n_status, n_wires) and returns: qml, sum