class_docstr: Tests for ``group_observables`` function using QWC, commuting, and anticommuting partitioning.
class_docstr_tok: ["Tests","for","``","group_observables","``","function","using","QWC",",","commuting",",","and","anticommuting","partitioning","."]
docstr: Tests that the ``group_observables`` function raises an exception if
  the lengths of coefficients and observables do not agree.
docstr_tok: ["Tests","that","the","``","group_observables","``","function","raises","an","exception","if","the","lengths","of","coefficients","and","observables","do","not","agree","."]
code: def test_group_observables_exception(self):
      """Tests that the ``group_observables`` function raises an exception if
      the lengths of coefficients and observables do not agree."""
      observables = [Identity(0), PauliX(1)]
      coefficients = [0.5]
      with pytest.raises(IndexError, match="must be the same length"):
          group_observables(observables, coefficients)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane import Identity, PauliX, PauliY, PauliZ
  from pennylane.pauli import are_identical_pauli_words
  from pennylane.pauli.grouping.group_observables import PauliGroupingStrategy, group_observables
  from pennylane import numpy
label_desc: Use image node_id 4 for calling the TestGroupObservables obj's underlying member method code with example usage: obj.test_group_observables_exception() without return types