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 a sample measurement with shot vectors works as expected
docstr_tok: ["Test","that","a","sample","measurement","with","shot","vectors","works","as","expected"]
code: def test_sample_measure_shot_vector(self, shots, total_copies):
      """Test that a sample measurement with shot vectors works as expected"""
      state = qml.math.array(two_qubit_state)
      shots = qml.measurements.Shots(shots)
      mp = qml.sample(wires=range(2))
  
      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, sh in zip(result, shots):
          assert isinstance(res, tuple)
          assert len(res) == 1
          res = res[0]
  
          assert res.shape == (sh, 2)
          assert res.dtype == np.int64
          assert all(
              qml.math.allequal(s, [0, 1])
              or qml.math.allequal(s, [1, 0])
              for s in res
          )
  
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 13 for calling the TestMeasureSamples obj's underlying member method code with example usage: obj.test_sample_measure_shot_vector(shots, total_copies) without return types