class_docstr: Pytree related checks.
class_docstr_tok: ["Pytree","related","checks","."]
docstr: Test that an operator with a bad leaf will raise an error.
docstr_tok: ["Test","that","an","operator","with","a","bad","leaf","will","raise","an","error","."]
code: def test_nested_bad_pytree(self):
      """Test that an operator with a bad leaf will raise an error."""
  
      class BadPytree(Operator):
          def _flatten(self):
              return tuple(), (self.wires, tuple())
  
          def __init__(self, wires, val="a"):
              super().__init__(wires)
              self.hyperparameters["val"] = val
  
      op = qml.adjoint(BadPytree(wires=0, val="b"))
      with pytest.raises(
          AssertionError, match=r"op must be a valid 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 4 for calling the TestPytree obj's underlying member method code with example usage: obj.test_nested_bad_pytree() and returns: tuple,  self,  tuple