class_docstr: Test that the measure_with_samples function works as expected
class_docstr_tok: ["Test","that","the","measure_with_samples","function","works","as","expected"]
docstr: Test that an expval measurement with shot vectors works as expected
docstr_tok: ["Test","that","an","expval","measurement","with","shot","vectors","works","as","expected"]
code: def test_expval_measure_shot_vector(self, shots, total_copies):
      """Test that an expval measurement with shot vectors works as expected"""
      state = qml.math.array(two_qubit_state)
      shots = qml.measurements.Shots(shots)
      mp = qml.expval(qml.prod(qml.PauliX(0), qml.PauliY(1)))
  
      result = measure_with_samples([mp], state, shots=shots)
  
      if total_copies == 1:
          result = (result,)
  
      assert isinstance(result, tuple)
      assert len(result) == total_copies
  
      for res in result:
          assert isinstance(res, tuple)
          assert len(res) == 1
          res = res[0]
  
          assert res.shape == ()
          assert res == -1
  
imports: from random import shuffle
  import pytest
  import numpy
  import pennylane
  from pennylane.devices.qubit import simulate
  from pennylane.devices.qubit.simulate import _FlexShots
  from pennylane.devices.qubit import sample_state, measure_with_samples
  from pennylane.devices.qubit.sampling import _sample_state_jax
  from pennylane.measurements import Shots
label_desc: Use image node_id 15 for calling the TestMeasureSamples obj's underlying member method code with example usage: obj.test_expval_measure_shot_vector(shots, total_copies) without return types