class_docstr: Test that the TrotterProduct can be executed and differentiated
  through all interfaces.
class_docstr_tok: ["Test","that","the","TrotterProduct","can","be","executed","and","differentiated","through","all","interfaces","."]
docstr: Test that the circuit executes as expected when we set the number of trotter steps
docstr_tok: ["Test","that","the","circuit","executes","as","expected","when","we","set","the","number","of","trotter","steps"]
code: def test_execute_circuit_n_steps(self, num_steps, order):
      """Test that the circuit executes as expected when we set the number of trotter steps"""
      time = 0.5
      hamiltonian = qml.sum(qml.PauliX(0), qml.PauliZ(0))
  
      if order == 1:
          base_decomp = [
              qml.exp(qml.PauliZ(0), 0.5j / num_steps),
              qml.exp(qml.PauliX(0), 0.5j / num_steps),
          ]
      if order == 2:
          base_decomp = [
              qml.exp(qml.PauliX(0), 0.25j / num_steps),
              qml.exp(qml.PauliZ(0), 0.25j / num_steps),
              qml.exp(qml.PauliZ(0), 0.25j / num_steps),
              qml.exp(qml.PauliX(0), 0.25j / num_steps),
          ]
  
      true_decomp = base_decomp * num_steps
  
      wires = hamiltonian.wires
      dev = qml.device("default.qubit", wires=wires)
  
      @qml.qnode(dev)
      def circ():
          qml.TrotterProduct(
              hamiltonian, time, n=num_steps, order=order
          )
          return qml.state()
  
      initial_state = qnp.zeros(2 ** (len(wires)))
      initial_state[0] = 1
  
      expected_state = (
          reduce(
              lambda x, y: x @ y,
              [
                  qml.matrix(op, wire_order=wires)
                  for op in true_decomp[::-1]
              ],
          )
          @ initial_state
      )
      state = circ()
      assert qnp.allclose(expected_state, state)
  
imports: import copy
  from functools import reduce
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.math import allclose, get_interface
  from pennylane.templates.subroutines.trotter import _recursive_expression, _scalar
label_desc: Use image node_id 2 for calling the TestIntegration obj's underlying member method code with example usage: obj.test_execute_circuit_n_steps(num_steps, order) and returns: qml