class_docstr: Tests for the broadcast_expand transform
class_docstr_tok: ["Tests","for","the","broadcast_expand","transform"]
docstr: Test that the transform integrates correctly with the transform program
docstr_tok: ["Test","that","the","transform","integrates","correctly","with","the","transform","program"]
code: def test_expansion_qnode(self, params, size, obs, exp_fn):
      """Test that the transform integrates correctly with the transform program"""
  
      @qml.transforms.broadcast_expand
      @qml.qnode(dev)
      def circuit(x, y, z, obs):
          qml.StatePrep(np.array([1, 0, 0, 0]), wires=[0, 1])
          RX_broadcasted(x, wires=0)
          qml.PauliY(0)
          RX_broadcasted(y, wires=1)
          RZ_broadcasted(z, wires=1)
          qml.Hadamard(1)
          return [qml.expval(ob) for ob in obs]
  
      result = circuit(*params, obs)
      expected = exp_fn(*params)
  
      if len(obs) > 1 and size == 1:
          expected = expected.T
  
      assert qml.math.allclose(result, expected)
  
file_path: pennylane/tests/transforms/test_broadcast_expand.py
imports: import pytest
  import numpy
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 2 for calling the TestBroadcastExpand obj's underlying member method code with example usage: obj.test_expansion_qnode(params, size, obs, exp_fn) and returns: unknown