class_docstr: Unit tests for the pwc_from_function decorator
class_docstr_tok: ["Unit","tests","for","the","pwc_from_function","decorator"]
docstr: Tests that both shapes for input t work when creating a pwc function
docstr_tok: ["Tests","that","both","shapes","for","input","t","work","when","creating","a","pwc","function"]
code: def test_t_input_types(self):
      """Tests that both shapes for input t work when creating a pwc function"""
  
      def f(params, t):
          return params[1] * t**2 + params[0]
  
      params = [1.2, 2.3]
  
      # should be identical, t1=0, t2=10
      f1 = qml.pulse.pwc_from_function(10, 12)(f)
      f2 = qml.pulse.pwc_from_function((0, 10), 12)(f)
  
      assert np.all(
          [
              f1(params, t) == f2(params, t)
              for t in np.linspace(-2, 12, 200)
          ]
      )
      assert f1(params, 10) == 0
      assert f2(params, 10) == 0
      assert f1(params, 0) == params[0]
      assert f2(params, 0) == params[0]
  
      # should set t1=1 instead of default t1=0
      f3 = qml.pulse.pwc_from_function((1, 3), 12)(f)
      assert f3(params, 3) == 0
      assert f3(params, 1) == f(params, 1)
      assert f3(params, 0) == 0
  
imports: import inspect
  from functools import partial
  import numpy
  import pytest
  import pennylane
  from pennylane.pulse.parametrized_hamiltonian import ParametrizedHamiltonian
label_desc: Use image node_id 6 for calling the TestPWC_from_function obj's underlying member method code with example usage: obj.test_t_input_types() and returns: unknown