class_docstr: Unit tests for the ParametrizedEvolution class.
class_docstr_tok: ["Unit","tests","for","the","ParametrizedEvolution","class","."]
docstr: Test that the keyword arguments return_intermediate and complementary are taken into
  account correctly at initialization and when calling. This includes testing
  inheritance when calling without explicitly providing these kwargs.
docstr_tok: ["Test","that","the","keyword","arguments","return_intermediate","and","complementary","are","taken","into","account","correctly","at","initialization","and","when","calling",".","This","includes","testing","inheritance","when","calling","without","explicitly","providing","these","kwargs","."]
code: def test_return_intermediate_and_complementary(
      self, ret_intmdt, comp
  ):
      """Test that the keyword arguments return_intermediate and complementary are taken into
      account correctly at initialization and when calling. This includes testing
      inheritance when calling without explicitly providing these kwargs.
      """
      ops = [qml.PauliX(0), qml.PauliY(1)]
      coeffs = [1, 2]
      t = [
          0.1,
          0.2,
          0.9,
      ]  # avoid warning because of simple time argument+return_intermediate
      H = ParametrizedHamiltonian(coeffs, ops)
      ev = ParametrizedEvolution(
          H=H,
          params=[],
          t=t,
          return_intermediate=ret_intmdt,
          complementary=comp,
      )
  
      assert ev.hyperparameters["return_intermediate"] is ret_intmdt
      assert ev.hyperparameters["complementary"] is comp
  
      new_ev = ev([], t=t)
  
      assert new_ev.hyperparameters["return_intermediate"] is ret_intmdt
      assert new_ev.hyperparameters["complementary"] is comp
  
      for new_ret_intmdt, new_comp in (
          [False, False],
          [True, False],
          [True, True],
      ):
          new_ev = ev(
              [],
              t=t,
              return_intermediate=new_ret_intmdt,
              complementary=new_comp,
          )
          assert (
              new_ev.hyperparameters["return_intermediate"]
              is new_ret_intmdt
          )
          assert new_ev.hyperparameters["complementary"] is new_comp
  
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 4 for calling the TestInitialization obj's underlying member method code with example usage: obj.test_return_intermediate_and_complementary(ret_intmdt, comp) without return types