class_docstr: Tests for the QubitSum operator
docstr: Test if ``QubitSum`` produces the correct output
docstr_tok: ["Test","if","``","QubitSum","``","produces","the","correct","output"]
code: def test_output(
      self, wires, input_state, output_state, expand, mocker
  ):
      """Test if ``QubitSum`` produces the correct output"""
      dev = qml.device("default.qubit", wires=3)
      spy = mocker.spy(qml.QubitSum, "decomposition")
  
      if expand:
          ops = [
              qml.StatePrep(input_state, wires=[0, 1, 2]),
              *qml.QubitSum(wires=wires).expand(),
          ]
      else:
          ops = [
              qml.StatePrep(input_state, wires=[0, 1, 2]),
              qml.QubitSum(wires=wires),
          ]
  
      tape = qml.tape.QuantumScript(ops, [qml.state()])
      result = dev.execute(tape)
      assert np.allclose(result, output_state)
  
      # checks that decomposition is only used when intended
      assert expand is (len(spy.call_args_list) != 0)
  
imports: import copy
  import itertools
  import pytest
  import numpy
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 1 for calling the TestQubitSum obj's underlying member method code with example usage: obj.test_output(wires, input_state, output_state, expand, mocker) without return types