class_docstr: Test that simulate works with broadcasted parameters
docstr: Test that simulate works for sample measurements
  when an operation has broadcasted parameters
docstr_tok: ["Test","that","simulate","works","for","sample","measurements","when","an","operation","has","broadcasted","parameters"]
code: def test_broadcasted_op_sample(self):
      """Test that simulate works for sample measurements
      when an operation has broadcasted parameters"""
      x = np.array([0.8, 1.0, 1.2, 1.4])
  
      ops = [
          qml.PauliX(wires=1),
          qml.RY(x, wires=0),
          qml.CNOT(wires=[0, 1]),
      ]
      measurements = [qml.expval(qml.PauliZ(i)) for i in range(2)]
  
      qs = qml.tape.QuantumScript(
          ops, measurements, shots=qml.measurements.Shots(10000)
      )
      res = simulate(qs, rng=123)
  
      assert isinstance(res, tuple)
      assert len(res) == 2
      assert np.allclose(res[0], np.cos(x), atol=0.05)
      assert np.allclose(res[1], -np.cos(x), atol=0.05)
  
      state, is_state_batched = get_final_state(qs)
      res = measure_final_state(qs, state, is_state_batched, rng=123)
  
      expected_state = np.zeros((4, 2, 2))
      expected_state[:, 0, 1] = np.cos(x / 2)
      expected_state[:, 1, 0] = np.sin(x / 2)
  
      assert np.allclose(state, expected_state)
      assert is_state_batched
      assert isinstance(res, tuple)
      assert len(res) == 2
      assert np.allclose(res[0], np.cos(x), atol=0.05)
      assert np.allclose(res[1], -np.cos(x), atol=0.05)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.devices.qubit import simulate, get_final_state, measure_final_state
label_desc: Use image node_id 4 for calling the TestBroadcasting obj's underlying member method code with example usage: obj.test_broadcasted_op_sample() without return types