class_docstr: Test that the measure_with_samples function works as expected
class_docstr_tok: ["Test","that","the","measure_with_samples","function","works","as","expected"]
docstr: Test that a sample measurement on a single wire works as expected
docstr_tok: ["Test","that","a","sample","measurement","on","a","single","wire","works","as","expected"]
code: def test_sample_measure_single_wire(self):
      """Test that a sample measurement on a single wire works as expected"""
      state = np.array([[1, -1j], [0, 0]]) / np.sqrt(2)
      shots = qml.measurements.Shots(100)
  
      mp0 = qml.sample(wires=0)
      mp1 = qml.sample(wires=1)
  
      result0 = measure_with_samples([mp0], state, shots=shots)[0]
      result1 = measure_with_samples([mp1], state, shots=shots)[0]
  
      assert result0.shape == (shots.total_shots,)
      assert result0.dtype == np.int64
      assert np.all(result0 == 0)
  
      assert result1.shape == (shots.total_shots,)
      assert result1.dtype == np.int64
      assert len(np.unique(result1)) == 2
  
imports: from random import shuffle
  import pytest
  import numpy
  import pennylane
  from pennylane.devices.qubit import simulate
  from pennylane.devices.qubit.simulate import _FlexShots
  from pennylane.devices.qubit import sample_state, measure_with_samples
  from pennylane.devices.qubit.sampling import _sample_state_jax
  from pennylane.measurements import Shots
label_desc: Use image node_id 2 for calling the TestMeasureSamples obj's underlying member method code with example usage: obj.test_sample_measure_single_wire() without return types