code: def test_template_with_return_integration(self):
      """Tests that the OperationRecorder integrates well with the
      core behaviour of PennyLane."""
      expected_output = (
          "Operations\n"
          + "==========\n"
          + "RZ(0, wires=[0])\n"
          + "RZ(3, wires=[0])\n"
          + "RZ(6, wires=[0])\n"
          + "RZ(9, wires=[0])\n"
          + "RZ(12, wires=[0])\n"
          + "\n"
          + "Observables\n"
          + "===========\n"
          + "PauliZ(wires=[0])\n"
          + "PauliX(wires=[1])\n"
      )
  
      def template(x):
          for i in range(5):
              qml.RZ(i * x, wires=0)
  
          return qml.var(qml.PauliZ(0)), qml.sample(qml.PauliX(1))
  
      with qml.tape.OperationRecorder() as recorder:
          template(3)
  
      assert str(recorder) == expected_output
  
imports: import pennylane
label_desc: Use image node_id 3 for calling the TestOperationRecorder obj's underlying member method code with example usage: obj.test_template_with_return_integration() and returns: qml,  qml