class_docstr: Tests for weighted random Hamiltonian term sampling
docstr: Checks that cost functions that are qnodes can
  
  disable use of weighted random sampling
docstr_tok: ["Checks","that","cost","functions","that","are","qnodes","can","disable","use","of","weighted","random","sampling"]
code: def test_wrs_disabled(self, mocker):
      """Checks that cost functions that are qnodes can
  
      disable use of weighted random sampling"""
      coeffs = [0.2, 0.1]
      dev = qml.device("default.qubit", wires=2, shots=100)
      H = qml.Hamiltonian(
          coeffs, [qml.PauliZ(0), qml.PauliZ(0) @ qml.PauliZ(1)]
      )
  
      @qml.qnode(dev)
      def circuit(weights):
          qml.StronglyEntanglingLayers(weights, wires=range(2))
          return qml.expval(H)
  
      weights = np.random.random(
          qml.templates.StronglyEntanglingLayers.shape(3, 2)
      )
  
      opt = qml.ShotAdaptiveOptimizer(min_shots=10, term_sampling=None)
      spy = mocker.spy(opt, "qnode_weighted_random_sampling")
  
      opt.step(circuit, weights)
      spy.assert_not_called()
  
imports: import pytest
  from flaky import flaky
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 3 for calling the TestQNodeWeightedRandomSampling obj's underlying member method code with example usage: obj.test_wrs_disabled(mocker) and returns: qml