class_docstr: Test assertions involving decompositions.
class_docstr_tok: ["Test","assertions","involving","decompositions","."]
docstr: Test that an error is raised if expand does not return a QuantumScript
docstr_tok: ["Test","that","an","error","is","raised","if","expand","does","not","return","a","QuantumScript"]
code: def test_expand_must_be_qscript(self):
      """Test that an error is raised if expand does not return a QuantumScript"""
  
      class BadDecomp(Operator):
          @staticmethod
          def compute_decomposition(wires):
              return [qml.RY(2.3, 0)]
  
          def expand(self):
              return [qml.S(0)]
  
      with pytest.raises(
          AssertionError, match=r"expand must return a QuantumScript"
      ):
          assert_valid(BadDecomp(wires=0), 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 3 for calling the TestDecompositionErrors obj's underlying member method code with example usage: obj.test_expand_must_be_qscript() and returns: list, list