class_docstr: Unit tests for the ParametrizedEvolution class.
class_docstr_tok: ["Unit","tests","for","the","ParametrizedEvolution","class","."]
docstr: Test that an error is raised when instantiating (or calling) a
  ParametrizedEvolution with the wrong number of parameters.
docstr_tok: ["Test","that","an","error","is","raised","when","instantiating","(","or","calling",")","a","ParametrizedEvolution","with","the","wrong","number","of","parameters","."]
code: def test_raises_wrong_number_of_params(self):
      """Test that an error is raised when instantiating (or calling) a
      ParametrizedEvolution with the wrong number of parameters."""
  
      # This Hamiltonian expects two scalar parameters
      H = time_dependent_hamiltonian()
  
      # Too few parameters
      params = (np.array(0.2),)
      with pytest.raises(
          ValueError,
          match="The length of the params argument and the number",
      ):
          # Instantiating
          qml.pulse.ParametrizedEvolution(H, params=params, t=0.2)
      op = qml.evolve(H)
      with pytest.raises(
          ValueError,
          match="The length of the params argument and the number",
      ):
          # Calling
          op(params, 0.2)
      # Too many parameters
      params = (np.array(0.2), np.array(2.1), np.array(0.4))
      with pytest.raises(
          ValueError,
          match="The length of the params argument and the number",
      ):
          # Calling
          op(params, 0.2)
  
imports: from functools import reduce
  import numpy
  import pytest
  import pennylane
  from pennylane.operation import AnyWires
  from pennylane.ops import QubitUnitary
  from pennylane.pulse import ParametrizedEvolution, ParametrizedHamiltonian
  from pennylane.tape import QuantumTape
  from pennylane.devices import DefaultQubit, DefaultQubitLegacy
label_desc: Use image node_id 17 for calling the TestInitialization obj's underlying member method code with example usage: obj.test_raises_wrong_number_of_params() without return types