class_docstr: Tests for the sum_expand transform
docstr: Test that the ``sum_expand`` function returns the input tape if it does not
  contain a single measurement with the expectation value of a Sum.
docstr_tok: ["Test","that","the","``","sum_expand","``","function","returns","the","input","tape","if","it","does","not","contain","a","single","measurement","with","the","expectation","value","of","a","Sum","."]
code: def test_non_sum_tape(self):
      """Test that the ``sum_expand`` function returns the input tape if it does not
      contain a single measurement with the expectation value of a Sum.
      """
  
      with AnnotatedQueue() as q:
          qml.expval(qml.PauliZ(0))
  
      tape = QuantumScript.from_queue(q)
  
      tapes, fn = sum_expand(tape)
  
      assert len(tapes) == 1
      assert isinstance(list(tapes[0])[0].obs, qml.PauliZ)
      # Old return types return a list for a single value:
      # e.g. qml.expval(qml.PauliX(0)) = [1.23]
      res = [1.23]
      assert fn(res) == 1.23
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.queuing import AnnotatedQueue
  from pennylane.tape import QuantumScript
  from pennylane.transforms import hamiltonian_expand, sum_expand
label_desc: Use image node_id 8 for calling the TestSumExpand obj's underlying member method code with example usage: obj.test_non_sum_tape() without return types