class_docstr: Test the support for executing tapes with multiple different
  measurements using a device with shot vectors
class_docstr_tok: ["Test","the","support","for","executing","tapes","with","multiple","different","measurements","using","a","device","with","shot","vectors"]
docstr: Test sample and counts measurements, each measurement with custom
  samples or computational basis state samples.
docstr_tok: ["Test","sample","and","counts","measurements",",","each","measurement","with","custom","samples","or","computational","basis","state","samples","."]
code: def test_sample_counts(
      self, shot_vector, sample_wires, counts_wires, device
  ):
      """Test sample and counts measurements, each measurement with custom
      samples or computational basis state samples."""
      dev = qml.device(device, wires=6, shots=shot_vector)
      raw_shot_vector = [
          shot_tuple.shots
          for shot_tuple in dev.shots.shot_vector
          for _ in range(shot_tuple.copies)
      ]
  
      @qml.qnode(device=dev)
      def circuit(x):
          qml.Hadamard(wires=[0])
          qml.CRX(x, wires=[0, 1])
  
          # 1. Sample obs and Counts obs
          if len(sample_wires) == 1 and len(counts_wires) == 1:
              return qml.sample(qml.PauliY(sample_wires)), qml.counts(
                  qml.PauliX(counts_wires)
              )
  
          # 2. Sample no obs and Counts obs
          if len(sample_wires) > 1 and len(counts_wires) == 1:
              return qml.sample(wires=sample_wires), qml.counts(
                  qml.PauliX(counts_wires)
              )
  
          # 3. Sample obs and Counts no obs
          if len(sample_wires) == 1 and len(counts_wires) > 1:
              return qml.sample(qml.PauliY(sample_wires)), qml.counts(
                  wires=counts_wires
              )
  
          # 4. Sample no obs and Counts no obs
          return qml.sample(wires=sample_wires), qml.counts(
              wires=counts_wires
          )
  
      qnode = qml.QNode(circuit, dev)
      qnode.construct([0.5], {})
      res = qml.execute(
          tapes=[qnode.tape], device=dev, gradient_fn=None
      )
  
      all_shots = sum(
          shot_tuple.copies for shot_tuple in dev.shots.shot_vector
      )
  
      assert isinstance(res[0], tuple)
      assert len(res[0]) == all_shots
      assert all(isinstance(r, tuple) for r in res[0])
      assert all(
          isinstance(measurement_res[0], (np.ndarray, np.float64))
          for measurement_res in res[0]
      )
      assert all(
          isinstance(measurement_res[1], dict)
          for measurement_res in res[0]
      )
  
      for idx, shots in enumerate(raw_shot_vector):
          for i, r in enumerate(res[0][idx]):
              num_wires = len(sample_wires)
              if shots == 1 and i % 2 == 0:
                  expected_shape = (
                      () if num_wires == 1 else (num_wires,)
                  )
                  assert r.shape == expected_shape
              elif i % 2 == 0:
                  expected_shape = (
                      (shots,) if num_wires == 1 else (shots, num_wires)
                  )
                  assert r.shape == expected_shape
              else:
                  assert isinstance(r, dict)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import MeasurementProcess
label_desc: Use image node_id 8 for calling the TestMixMeasurementsShotVector obj's underlying member method code with example usage: obj.test_sample_counts(shot_vector, sample_wires, counts_wires, device) and returns: qml,  qml, qml,  qml, qml,  qml, qml,  qml