class_docstr: Pattern matching circuit optimization tests.
class_docstr_tok: ["Pattern","matching","circuit","optimization","tests","."]
docstr: Test that we cannot have less qubit in the circuit than in the pattern.
docstr_tok: ["Test","that","we","can","not","have","less","qubit","in","the","circuit","than","in","the","pattern","."]
code: def test_less_qubit_circuit(self):
      """Test that we cannot have less qubit in the circuit than in the pattern."""
  
      def circuit():
          qml.PauliX(wires=0)
          return qml.expval(qml.PauliX(wires=0))
  
      with qml.queuing.AnnotatedQueue() as q_template:
          qml.CNOT(wires=[0, 1])
          qml.CNOT(wires=[0, 1])
  
      template = qml.tape.QuantumScript.from_queue(q_template)
      dev = qml.device("default.qubit", wires=1)
  
      with pytest.raises(
          qml.QuantumFunctionError,
          match="Circuit has less qubits than the pattern.",
      ):
          optimized_qfunc = pattern_matching_optimization(
              circuit, pattern_tapes=[template]
          )
          optimized_qnode = qml.QNode(optimized_qfunc, dev)
          optimized_qnode()
  
imports: import pytest
  import pennylane
  import pennylane.numpy
  from pennylane.transforms.commutation_dag import commutation_dag
  from pennylane.transforms.optimization.pattern_matching import pattern_matching, pattern_matching_optimization, ForwardMatch, BackwardMatch, _update_qubits
label_desc: Use image node_id 16 for calling the TestPatternMatchingOptimization obj's underlying member method code with example usage: obj.test_less_qubit_circuit() and returns: qml