class_docstr: Test the utility function _parshift_and_contract.
class_docstr_tok: ["Test","the","utility","function","_parshift_and_contract","."]
docstr: Test _parshift_and_contract with a single measurement without shot vector.
docstr_tok: ["Test","_parshift_and_contract","with","a","single","measurement","without","shot","vector","."]
code: def test_single_measure_no_shot_vector(self, num_params, num_out):
      """Test _parshift_and_contract with a single measurement without shot vector."""
      values = np.arange(1, num_params + 1)
      # Emulate results to be [1.2*value, -0.42*value], leading to the expected PSR
      # derivative 0.81*value
      results = [
          np.array(pref * v) for v in values for pref in [1.2, -0.42]
      ]
      coeffs = [np.random.random(num_out) for _ in range(num_params)]
      output = _parshift_and_contract(
          results, coeffs, single_measure=True, single_shot_entry=True
      )
      assert isinstance(output, np.ndarray)
      assert output.shape == (num_out,)
      expected = 0.81 * values @ np.stack(coeffs)
      assert qml.math.allclose(output, expected)
  
imports: import copy
  import pytest
  import numpy
  import pennylane
  from pennylane import numpy
  from pennylane.ops.qubit.special_unitary import pauli_basis_matrices, pauli_basis_strings
  from pennylane.math import expand_matrix
  from pennylane.gradients.pulse_gradient_odegen import _generate_tapes_and_coeffs, pulse_odegen, _insert_op, _nonzero_coeffs_and_words, _one_parameter_generators, _one_parameter_paulirot_coeffs, _parshift_and_contract
label_desc: Use image node_id 1 for calling the TestParshiftAndContract obj's underlying member method code with example usage: obj.test_single_measure_no_shot_vector(num_params, num_out) without return types