class_docstr: Tests for the qfunc_transform decorator
class_docstr_tok: ["Tests","for","the","qfunc_transform","decorator"]
docstr: Tests that qfunc_transform doesn't add an empty list of measurements to a QNode.
docstr_tok: ["Tests","that","qfunc_transform","does","n't","add","an","empty","list","of","measurements","to","a","QNode","."]
code: def test_transform_does_not_add_return_value_to_qnode(self):
      """Tests that qfunc_transform doesn't add an empty list of measurements to a QNode."""
  
      @qml.qfunc_transform
      def expand_hadamards(tape):
          for op in tape:
              if op.name == "Hadamard":
                  qml.RZ(np.pi, wires=op.wires)
                  qml.RY(np.pi / 2, wires=op.wires)
              else:
                  op.queue()
  
      @expand_hadamards
      def ansatz():
          qml.Hadamard(wires=0)
          qml.CNOT(wires=[0, 1])
  
      assert ansatz() is None
  
      qnode = qml.QNode(ansatz, qml.device("default.qubit", wires=2))
      with pytest.raises(
          qml.QuantumFunctionError,
          match="return either a single measurement",
      ):
          qnode()
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 10 for calling the TestQFuncTransforms obj's underlying member method code with example usage: obj.test_transform_does_not_add_return_value_to_qnode() without return types