class_docstr: Tests for the sample function
class_docstr_tok: ["Tests","for","the","sample","function"]
docstr: Test that the shape is correct.
docstr_tok: ["Test","that","the","shape","is","correct","."]
code: def test_shape(self, obs):
      """Test that the shape is correct."""
      shots = 10
      dev = qml.device("default.qubit.legacy", wires=3, shots=shots)
      res = qml.sample(obs) if obs is not None else qml.sample()
      expected = (shots,) if obs is not None else (shots, 3)
      assert res.shape(dev, Shots(shots)) == expected
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import MeasurementShapeError, Sample, Shots, MeasurementValue
  from pennylane.operation import Operator
label_desc: Use image node_id 16 for calling the TestSample obj's underlying member method code with example usage: obj.test_shape(obs) without return types