class_docstr: Tests for the sum_expand transform
docstr: Tests that the sum_expand transform returns the correct value
docstr_tok: ["Tests","that","the","sum_expand","transform","returns","the","correct","value"]
code: def test_sums_legacy(self, qscript, output):
      """Tests that the sum_expand transform returns the correct value"""
      dev_old = qml.device("default.qubit.legacy", wires=4)
      tapes, fn = sum_expand(qscript)
      results = dev_old.batch_execute(tapes)
      expval = fn(results)
  
      assert all(
          qml.math.allclose(o, e) for o, e in zip(output, expval)
      )
  
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 3 for calling the TestSumExpand obj's underlying member method code with example usage: obj.test_sums_legacy(qscript, output) without return types