class_docstr: Tests that ensure various qubit circuits integrate correctly
class_docstr_tok: ["Tests","that","ensure","various","qubit","circuits","integrate","correctly"]
docstr: Test sampling works as expected
docstr_tok: ["Test","sampling","works","as","expected"]
code: def test_sampling(
      self, dev, diff_method, grad_on_execution, device_vjp
  ):
      """Test sampling works as expected"""
      if grad_on_execution is True:
          pytest.skip(
              "Sampling not possible with grad_on_execution differentiation."
          )
  
      if diff_method == "adjoint":
          pytest.skip("Adjoint warns with finite shots")
  
      @qnode(
          dev,
          diff_method=diff_method,
          interface="jax",
          grad_on_execution=grad_on_execution,
          device_vjp=device_vjp,
      )
      def circuit():
          qml.Hadamard(wires=[0])
          qml.CNOT(wires=[0, 1])
          return qml.sample(qml.PauliZ(0)), qml.sample(qml.PauliX(1))
  
      res = circuit(shots=10)
  
      assert isinstance(res, tuple)
  
      assert isinstance(res[0], jax.Array)
      assert res[0].shape == (
          10,
      )  # pylint:disable=comparison-with-callable
      assert isinstance(res[1], jax.Array)
      assert res[1].shape == (10,)
  
imports: from itertools import product
  import numpy
  import pytest
  import pennylane
  from pennylane import qnode
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 1 for calling the TestQubitIntegration obj's underlying member method code with example usage: obj.test_sampling(dev, diff_method, grad_on_execution, device_vjp) and returns: qml,  qml