class_docstr: Tests for the hamiltonian_expand transform
class_docstr_tok: ["Tests","for","the","hamiltonian_expand","transform"]
docstr: Test that the grouping in a Hamiltonian is used
docstr_tok: ["Test","that","the","grouping","in","a","Hamiltonian","is","used"]
code: def test_grouping_is_used(self):
      """Test that the grouping in a Hamiltonian is used"""
      H = qml.Hamiltonian(
          [1.0, 2.0, 3.0],
          [qml.PauliZ(0), qml.PauliX(1), qml.PauliX(0)],
          grouping_type="qwc",
      )
      assert H.grouping_indices is not None
  
      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) == 2
  
      qs = QuantumScript(tape.operations, tape.measurements)
      tapes, _ = hamiltonian_expand(qs, group=False)
      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 4 for calling the TestHamiltonianExpand obj's underlying member method code with example usage: obj.test_grouping_is_used() without return types