class_docstr: Test that GroverOperator is applied correctly.
class_docstr_tok: ["Test","that","GroverOperator","is","applied","correctly","."]
docstr: Test that apply_operation is correct for GroverOperator for all dispatch branches
  but einsum (because Grover can't act on a single wire)
  when applying it only to some of the wires of a state.
docstr_tok: ["Test","that","apply_operation","is","correct","for","GroverOperator","for","all","dispatch","branches","but","einsum","(","because","Grover","ca","n't","act","on","a","single","wire",")","when","applying","it","only","to","some","of","the","wires","of","a","state","."]
code: def test_correctness_partial_wires(
      self, op_wires, state_wires, batch_dim
  ):
      """Test that apply_operation is correct for GroverOperator for all dispatch branches
      but einsum (because Grover can't act on a single wire)
      when applying it only to some of the wires of a state."""
      np.random.seed(752)
      batched = batch_dim is not None
      shape = (
          [batch_dim] + [2] * state_wires
          if batched
          else [2] * state_wires
      )
      state = np.random.random(shape) + 1j * np.random.random(shape)
  
      for start_wire in [0, 1, state_wires - op_wires]:
          wires = list(range(start_wire, start_wire + op_wires))
          op = qml.GroverOperator(wires)
          out = apply_operation(
              op, state, is_state_batched=batched, debugger=None
          )
          expected_via_mat = apply_operation_tensordot(
              op, state, batched
          )
          expected_via_kernel = self.grover_kernel_partial_wires(
              state, wires, batched
          )
          assert np.allclose(out, expected_via_mat)
          assert np.allclose(out, expected_via_kernel)
  
imports: from functools import reduce
  import pytest
  import numpy
  from scipy.stats import unitary_group
  import pennylane
  from pennylane.operation import _UNSET_BATCH_SIZE, Operation
  from pennylane.devices.qubit.apply_operation import apply_operation, apply_operation_einsum, apply_operation_tensordot
label_desc: Use image node_id 5 for calling the TestApplyGroverOperator obj's underlying member method code with example usage: obj.test_correctness_partial_wires(op_wires, state_wires, batch_dim) without return types