class_docstr: Unit tests for the pwc_from_function decorator
class_docstr_tok: ["Unit","tests","for","the","pwc_from_function","decorator"]
docstr: Test that output values for the pwc version functions and the inital function match each other
  when t is one of the input time_bins
docstr_tok: ["Test","that","output","values","for","the","pwc","version","functions","and","the","inital","function","match","each","other","when","t","is","one","of","the","input","time_bins"]
code: def test_expected_values_are_returned(self):
      """Test that output values for the pwc version functions and the inital function match each other
      when t is one of the input time_bins"""
  
      def f_initial(param, t):
          return t**2 + param
  
      f_pwc = qml.pulse.pwc_from_function(timespan=9, num_bins=10)(
          f_initial
      )
  
      @qml.pulse.pwc_from_function(timespan=9, num_bins=10)
      def f_decorated(param, t):
          return t**2 + param
  
      time_bins = np.linspace(0, 9, 10)
      for i in time_bins:
          # pwc functions should match initial function between times i-1 and i,
          # i.e. points just before time i should always match
          assert f_initial(2, i) == f_pwc(2, i * 0.99)
          assert f_initial(2, i) == f_decorated(2, i * 0.99)
  
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 3 for calling the TestPWC_from_function obj's underlying member method code with example usage: obj.test_expected_values_are_returned() and returns: unknown, unknown