class_docstr: Tests that the template defines the correct decomposition.
class_docstr_tok: ["Tests","that","the","template","defines","the","correct","decomposition","."]
docstr: Test that the number of gates is correct.
docstr_tok: ["Test","that","the","number","of","gates","is","correct","."]
code: def test_number_gates(self, n_layers, n_rots):
      """Test that the number of gates is correct."""
      weights = np.random.randn(n_layers, n_rots)
  
      op = qml.RandomLayers(weights, wires=range(2))
      ops = op.expand().operations
  
      gate_names = [g.name for g in ops]
      assert (
          len(gate_names) - gate_names.count("CNOT")
          == n_layers * n_rots
      )
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 2 for calling the TestDecomposition obj's underlying member method code with example usage: obj.test_number_gates(n_layers, n_rots) without return types