class_docstr: Tests the built-in patterns ("single", "ring", etc) of the broadcast template constructor.
class_docstr_tok: ["Tests","the","built-in","patterns","(","``","single","''",",","``","ring","''",",","etc",")","of","the","broadcast","template","constructor","."]
docstr: Tests the state produced by different unitaries.
docstr_tok: ["Tests","the","state","produced","by","different","unitaries","."]
code: def test_prepares_correct_state(
      self, pattern, n_wires, parameters, unitary, target
  ):
      """Tests the state produced by different unitaries."""
  
      dev = qml.device("default.qubit", wires=n_wires)
  
      @qml.qnode(dev)
      def circuit():
          for w in range(4):
              qml.PauliX(wires=w)
          broadcast(
              unitary=unitary,
              pattern=pattern,
              wires=range(4),
              parameters=parameters,
          )
          return [qml.expval(qml.PauliZ(wires=w)) for w in range(4)]
  
      res = circuit()
      assert np.allclose(res, target)
  
imports: from math import pi
  import pytest
  import numpy
  import pennylane
  from pennylane.templates import broadcast
  from pennylane.ops import RX, RY, T, S, Rot, CRX, CRot, CNOT
  from pennylane.templates.broadcast import wires_pyramid, wires_all_to_all, wires_ring
  from pennylane.wires import Wires
label_desc: Use image node_id 6 for calling the TestBuiltinPatterns obj's underlying member method code with example usage: obj.test_prepares_correct_state(pattern, n_wires, parameters, unitary, target) and returns: unknown