class_docstr: Unit tests for the pwc_from_function decorator
class_docstr_tok: ["Unit","tests","for","the","pwc_from_function","decorator"]
docstr: Test the pwc function has been divided into the expected number of bins
docstr_tok: ["Test","the","pwc","function","has","been","divided","into","the","expected","number","of","bins"]
code: def test_num_bins_is_correct(self, num_bins):
      """Test the pwc function has been divided into the expected number of bins"""
  
      def f_initial(param, t):
          return t + param
  
      f_pwc = qml.pulse.pwc_from_function(
          timespan=9, num_bins=num_bins
      )(f_initial)
  
      # check that there are only a limited number of unique output values for the pwc function
      y = [float(f_pwc(2, i)) for i in np.linspace(0, 9, 1000)]
  
      assert len(set(y)) == num_bins + 1
  
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 4 for calling the TestPWC_from_function obj's underlying member method code with example usage: obj.test_num_bins_is_correct(num_bins) and returns: unknown