class_docstr: Tests that the Barrier gate is correct.
class_docstr_tok: ["Tests","that","the","Barrier","gate","is","correct","."]
docstr: Test that the barrier doesn't influence compilation when the only_visual parameter is True.
docstr_tok: ["Test","that","the","barrier","does","n't","influence","compilation","when","the","only_visual","parameter","is","True","."]
code: def test_barrier_only_visual(self):
      r"""Test that the barrier doesn't influence compilation when the only_visual parameter is True."""
  
      def qfunc():
          qml.Hadamard(wires=0)
          qml.Barrier(only_visual=True, wires=0)
          qml.Hadamard(wires=0)
          return qml.expval(qml.PauliZ(0))
  
      dev = qml.device("default.qubit", wires=3)
      optimized_qfunc = qml.compile(qfunc)
      optimized_qnode = qml.QNode(optimized_qfunc, dev)
      optimized_gates = qml.specs(optimized_qnode)()[
          "resources"
      ].gate_sizes[1]
  
      assert optimized_gates == 0
  
imports: import pytest
  import numpy
  from pennylane import Snapshot
  import pennylane
label_desc: Use image node_id 2 for calling the TestBarrier obj's underlying member method code with example usage: obj.test_barrier_only_visual() and returns: qml