class_docstr: Test the SPSA optimizer.
docstr: Test that if the objective function is not a
  scalar function, like qml.probs(), an error is raised.
docstr_tok: ["Test","that","if","the","objective","function","is","not","a","scalar","function",",","like","qml.probs","(",")",",","an","error","is","raised","."]
code: def test_obj_func_with_probs_not_a_scalar_function(self):
      """Test that if the objective function is not a
      scalar function, like qml.probs(), an error is raised."""
  
      n_wires = 4
      n_layers = 3
      dev = qml.device("default.qubit", wires=n_wires)
  
      def circuit(params):
          qml.StronglyEntanglingLayers(
              params, wires=list(range(n_wires))
          )
  
      @qml.qnode(dev)
      def cost(params):
          circuit(params)
          return qml.probs(wires=[0, 1, 2, 3])
  
      opt = qml.SPSAOptimizer(maxiter=10)
      params = np.random.normal(
          scale=0.1, size=(n_layers, n_wires, 3), requires_grad=True
      )
  
      with pytest.raises(
          ValueError,
          match="The objective function must be a scalar function for the gradient ",
      ):
          opt.step(cost, params)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 14 for calling the TestSPSAOptimizer obj's underlying member method code with example usage: obj.test_obj_func_with_probs_not_a_scalar_function() and returns: qml