class_docstr: Pytree related checks.
class_docstr_tok: ["Pytree","related","checks","."]
docstr: Test an error is raised if data and pytree leaves have a different ordering convention.
docstr_tok: ["Test","an","error","is","raised","if","data","and","pytree","leaves","have","a","different","ordering","convention","."]
code: def test_bad_leaves_ordering(self):
      """Test an error is raised if data and pytree leaves have a different ordering convention."""
  
      class BadLeavesOrdering(qml.ops.op_math.SProd):
          def _flatten(self):
              return (self.base, self.scalar), tuple()
  
          @classmethod
          def _unflatten(cls, data, _):
              return cls(data[1], data[0])
  
      op = BadLeavesOrdering(2.0, qml.RX(1.2, wires=0))
  
      with pytest.raises(
          AssertionError,
          match=r"data must be the terminal leaves of the pytree",
      ):
          assert_valid(op, skip_pickle=True)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.operation import Operator
  from pennylane.ops.functions import assert_valid
label_desc: Use image node_id 5 for calling the TestPytree obj's underlying member method code with example usage: obj.test_bad_leaves_ordering() and returns: self,  self,  tuple, cls