class_docstr: Tests for the transform specs using the QNode
class_docstr_tok: ["Tests","for","the","transform","specs","using","the","QNode"]
docstr: Test the specs transforms works in standard situations
docstr_tok: ["Test","the","specs","transforms","works","in","standard","situations"]
code: def test_specs(self, diff_method, len_info):
      """Test the specs transforms works in standard situations"""
      dev = qml.device("default.qubit", wires=4)
  
      @qml.qnode(dev, diff_method=diff_method)
      def circuit(x, y, add_RY=True):
          qml.RX(x[0], wires=0)
          qml.Toffoli(wires=(0, 1, 2))
          qml.CRY(x[1], wires=(0, 1))
          qml.Rot(x[2], x[3], y, wires=2)
          if add_RY:
              qml.RY(x[4], wires=1)
          return qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliX(1))
  
      x = np.array([0.05, 0.1, 0.2, 0.3, 0.5], requires_grad=True)
      y = np.array(0.1, requires_grad=False)
  
      info_func = qml.specs(circuit)
  
      info = info_func(x, y, add_RY=False)
  
      circuit(x, y, add_RY=False)
  
      assert len(info) == len_info
  
      gate_sizes = defaultdict(int, {1: 2, 3: 1, 2: 1})
      gate_types = defaultdict(
          int, {"RX": 1, "Toffoli": 1, "CRY": 1, "Rot": 1}
      )
      expected_resources = qml.resource.Resources(
          num_wires=3,
          num_gates=4,
          gate_types=gate_types,
          gate_sizes=gate_sizes,
          depth=3,
      )
      assert info["resources"] == expected_resources
  
      assert info["num_observables"] == 2
      assert info["num_diagonalizing_gates"] == 1
      assert info["num_device_wires"] == 3
      assert info["diff_method"] == diff_method
      assert info["num_trainable_params"] == 4
      assert info["device_name"] == dev.name
  
      if diff_method == "parameter-shift":
          assert info["num_gradient_executions"] == 6
  
file_path: pennylane/tests/resource/test_specs.py
imports: from typing import Sequence, Callable
  from collections import defaultdict
  from contextlib import nullcontext
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 2 for calling the TestSpecsTransform obj's underlying member method code with example usage: obj.test_specs(diff_method, len_info) and returns: qml,  qml