class_docstr: Test conversion of queues to DAGs
class_docstr_tok: ["Test","conversion","of","queues","to","DAGs"]
docstr: A test to ensure the sample operation applies to all wires on the
  `CircuitGraph`s grid when none are explicitly provided.
docstr_tok: ["A","test","to","ensure","the","sample","operation","applies","to","all","wires","on","the","`","CircuitGraph","`","s","grid","when","none","are","explicitly","provided","."]
code: def test_grid_when_sample_no_wires(self):
      """A test to ensure the sample operation applies to all wires on the
      `CircuitGraph`s grid when none are explicitly provided."""
  
      ops = [qml.Hadamard(wires=0), qml.CNOT(wires=[0, 1])]
      obs_no_wires = [qml.sample(op=None, wires=None)]
      obs_w_wires = [qml.sample(op=None, wires=[0, 1, 2])]
  
      circuit_no_wires = CircuitGraph(
          ops, obs_no_wires, wires=Wires([0, 1, 2])
      )
      circuit_w_wires = CircuitGraph(
          ops, obs_w_wires, wires=Wires([0, 1, 2])
      )
  
      sample_w_wires_op = qml.sample(op=None, wires=[0, 1, 2])
      expected_grid_w_wires = {
          0: [ops[0], ops[1], sample_w_wires_op],
          1: [ops[1], sample_w_wires_op],
          2: [sample_w_wires_op],
      }
  
      sample_no_wires_op = qml.sample(op=None, wires=None)
      expected_grid_no_wires = {
          0: [ops[0], ops[1], sample_no_wires_op],
          1: [ops[1], sample_no_wires_op],
          2: [sample_no_wires_op],
      }
  
      for key in range(3):
          lst_w_wires = circuit_w_wires._grid[key]
          lst_no_wires = circuit_no_wires._grid[key]
          lst_expected_w_wires = expected_grid_w_wires[key]
          lst_expected_no_wires = expected_grid_no_wires[key]
  
          for el1, el2 in zip(lst_w_wires, lst_expected_w_wires):
              assert qml.equal(el1, el2)
  
          for el1, el2 in zip(lst_no_wires, lst_expected_no_wires):
              assert qml.equal(el1, el2)
  
imports: import io
  import contextlib
  import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.resource import ResourcesOperation, Resources
  from pennylane.circuit_graph import CircuitGraph
  from pennylane.wires import Wires
label_desc: Use image node_id 13 for calling the TestCircuitGraph obj's underlying member method code with example usage: obj.test_grid_when_sample_no_wires() without return types