class_docstr: Unit tests on ``qml.transforms.split_non_commuting()``
class_docstr_tok: ["Unit","tests","on","``","qml.transforms.split_non_commuting","(",")","``"]
docstr: Test that the no. of tapes after splitting into commuting groups is of the right size
docstr_tok: ["Test","that","the","no",".","of","tapes","after","splitting","into","commuting","groups","is","of","the","right","size"]
code: def test_non_commuting_group_right_number(
      self, meas_type, obs_list, expected
  ):
      """Test that the no. of tapes after splitting into commuting groups is of the right size"""
  
      # create a queue with several measurements of same type but with differnent non-commuting
      # observables
      with qml.queuing.AnnotatedQueue() as q:
          qml.PauliZ(0)
          qml.Hadamard(0)
          qml.CNOT((0, 1))
          for obs in obs_list:
              meas_type(op=obs)
  
          # if MP type can accept wires, then add two extra measurements using wires and test no.
          # of tapes after splitting commuting groups
          if meas_type in wire_meas_fn:
              meas_type(wires=[0])
              meas_type(wires=[0, 1])
  
      tape = qml.tape.QuantumScript.from_queue(q)
      split, _ = split_non_commuting(tape)
      assert len(split) == expected
  
      qs = qml.tape.QuantumScript(tape.operations, tape.measurements)
      split, _ = split_non_commuting(qs)
      assert len(split) == expected
  
imports: import itertools
  import pytest
  import numpy
  import pennylane
  import pennylane.numpy
  from pennylane.transforms import split_non_commuting
label_desc: Use image node_id 3 for calling the TestUnittestSplitNonCommuting obj's underlying member method code with example usage: obj.test_non_commuting_group_right_number(meas_type, obs_list, expected) without return types