class_docstr: Tests for the hamiltonian_expand transform
class_docstr_tok: ["Tests","for","the","hamiltonian_expand","transform"]
docstr: Test the conditional logic for `len(c_group) == 1` and `len(r_group) != 1`
  in the processing function returned by hamiltonian_expand, accessed when
  using a shot vector and grouping if the terms don't commute with each other.
docstr_tok: ["Test","the","conditional","logic","for","`","len","(","c_group",")","==","1","`","and","`","len","(","r_group",")","!","=","1","`","in","the","processing","function","returned","by","hamiltonian_expand",",","accessed","when","using","a","shot","vector","and","grouping","if","the","terms","do","n't","commute","with","each","other","."]
code: def test_processing_function_conditional_clause(self):
      """Test the conditional logic for `len(c_group) == 1` and `len(r_group) != 1`
      in the processing function returned by hamiltonian_expand, accessed when
      using a shot vector and grouping if the terms don't commute with each other.
      """
  
      dev_with_shot_vector = qml.device(
          "default.qubit", shots=(10, 10, 10)
      )
  
      H = qml.Hamiltonian([1, 2.0], [qml.PauliZ(0), qml.PauliX(0)])
      H.compute_grouping()
  
      @qml.transforms.hamiltonian_expand
      @qml.qnode(dev_with_shot_vector)
      def circuit():
          return qml.expval(H)
  
      res = circuit()
  
      assert res.shape == (3,)
  
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 11 for calling the TestHamiltonianExpand obj's underlying member method code with example usage: obj.test_processing_function_conditional_clause() and returns: qml