class_docstr: Tests for the sample function
class_docstr_tok: ["Tests","for","the","sample","function"]
docstr: Test that the sample function outputs samples of the right size
docstr_tok: ["Test","that","the","sample","function","outputs","samples","of","the","right","size"]
code: def test_sample_dimension(self, n_sample):
      """Test that the sample function outputs samples of the right size"""
  
      dev = qml.device("default.qubit", wires=2, shots=n_sample)
  
      @qml.qnode(dev)
      def circuit():
          qml.RX(0.54, wires=0)
          return qml.sample(qml.PauliZ(0)), qml.sample(qml.PauliX(1))
  
      output = circuit()
  
      assert len(output) == 2
      assert circuit._qfunc_output[0].shape(dev, Shots(n_sample)) == (
          (n_sample,) if not n_sample == 1 else ()
      )
      assert circuit._qfunc_output[1].shape(dev, Shots(n_sample)) == (
          (n_sample,) if not n_sample == 1 else ()
      )
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import MeasurementShapeError, Sample, Shots
  from pennylane.operation import EigvalsUndefinedError, Operator
label_desc: Use image node_id 1 for calling the TestSample obj's underlying member method code with example usage: obj.test_sample_dimension(n_sample) and returns: qml,  qml