class_docstr: Test that measurements work when the state has a batch dim
class_docstr_tok: ["Test","that","measurements","work","when","the","state","has","a","batch","dim"]
docstr: Test that broadcasting works for the other sample measurements and single shots
docstr_tok: ["Test","that","broadcasting","works","for","the","other","sample","measurements","and","single","shots"]
code: def test_nonsample_measure(self, measurement, expected):
      """Test that broadcasting works for the other sample measurements and single shots"""
  
      rng = np.random.default_rng(123)
      shots = qml.measurements.Shots(10000)
  
      state = [
          np.array([[0, 0], [0, 1]]),
          np.array([[1, 0], [1, 0]]) / np.sqrt(2),
          np.array([[1, 1], [1, 1]]) / 2,
      ]
      state = np.stack(state)
  
      res = measure_with_samples(
          [measurement], state, shots, is_state_batched=True, rng=rng
      )
      assert np.allclose(res, expected, atol=0.01)
  
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 TestBroadcasting obj's underlying member method code with example usage: obj.test_nonsample_measure(measurement, expected) without return types