class_docstr: Tests for the hamiltonian_expand transform
class_docstr_tok: ["Tests","for","the","hamiltonian_expand","transform"]
docstr: Tests that the the correct number of tapes is produced
docstr_tok: ["Tests","that","the","the","correct","number","of","tapes","is","produced"]
code: def test_number_of_tapes(self):
      """Tests that the the correct number of tapes is produced"""
  
      H = qml.Hamiltonian(
          [1.0, 2.0, 3.0], [qml.PauliZ(0), qml.PauliX(1), qml.PauliX(0)]
      )
  
      with AnnotatedQueue() as q:
          qml.Hadamard(wires=0)
          qml.CNOT(wires=[0, 1])
          qml.PauliX(wires=2)
          qml.expval(H)
  
      tape = QuantumScript.from_queue(q)
      tapes, _ = hamiltonian_expand(tape, group=False)
      assert len(tapes) == 3
  
      tapes, _ = hamiltonian_expand(tape, group=True)
      assert len(tapes) == 2
  
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 5 for calling the TestHamiltonianExpand obj's underlying member method code with example usage: obj.test_number_of_tapes() without return types