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 scalar-valued, probability, sample and counts measurements all
  in a single qfunc.
docstr_tok: ["Test","scalar-valued",",","probability",",","sample","and","counts","measurements","all","in","a","single","qfunc","."]
code: def test_scalar_probs_sample_counts(
      self, shot_vector, meas1, meas2, device
  ):
      """Test scalar-valued, probability, sample and counts measurements all
      in a single qfunc."""
      dev = qml.device(device, wires=5, shots=shot_vector)
      raw_shot_vector = [
          shot_tuple.shots
          for shot_tuple in dev.shots.shot_vector
          for _ in range(shot_tuple.copies)
      ]
  
      def circuit(x):
          qml.Hadamard(wires=[0])
          qml.CRX(x, wires=[0, 1])
          return (
              qml.apply(meas1),
              qml.apply(meas2),
              qml.sample(qml.PauliX(4)),
              qml.counts(qml.PauliX(3)),
          )
  
      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])
  
      for res_idx, meas_res in enumerate(res[0]):
          for i, r in enumerate(meas_res):
              num_meas = i % 4
              expval_or_var = num_meas == 0
              probs = num_meas == 1
              sample = num_meas == 2
  
              if expval_or_var:
                  assert r.shape == ()
              elif probs:
                  assert r.shape == (2**2,)
  
                  # Probs add up to 1
                  assert np.allclose(sum(r), 1)
              elif sample:
                  shots = raw_shot_vector[res_idx]
                  if shots == 1:
                      assert r.shape == ()
                  else:
                      expected = (shots,)
                      assert r.shape == expected
              else:
                  # Return is Counts
                  assert isinstance(r, dict)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import MeasurementProcess
label_desc: Use image node_id 9 for calling the TestMixMeasurementsShotVector obj's underlying member method code with example usage: obj.test_scalar_probs_sample_counts(shot_vector, meas1, meas2, device) and returns: qml,  qml,  qml,  qml