class_docstr: Tests that the noise mitigation techniques raise an error whenever the
  used quantities are too small.
class_docstr_tok: ["Tests","that","the","noise","mitigation","techniques","raise","an","error","whenever","the","used","quantities","are","too","small","."]
docstr: Test that an error is raised when using the average method for the
  mitigation of depolarizing noise with a matrix that has too small diagonal
  entries.
docstr_tok: ["Test","that","an","error","is","raised","when","using","the","average","method","for","the","mitigation","of","depolarizing","noise","with","a","matrix","that","has","too","small","diagonal","entries","."]
code: def test_mitigate_depolarizing_noise_average_method_error(self):
      """Test that an error is raised when using the average method for the
      mitigation of depolarizing noise with a matrix that has too small diagonal
      entries."""
      num_wires = 6
      wires = range(num_wires)
  
      dev = qml.device("default.qubit", wires=num_wires)
  
      @qml.qnode(dev)
      def kernel_circuit(x1, x2):
          qml.templates.AngleEmbedding(x1, wires=wires)
          qml.adjoint(qml.templates.AngleEmbedding)(x2, wires=wires)
          return qml.probs(wires)
  
      def kernel(x1, x2):
          return kernel_circuit(x1, x2)[0]
  
      # "Training feature vectors"
      X_train = qml.numpy.tensor(
          [
              [0.73096199, 0.19012506, 0.57223395],
              [0.78126872, 0.53535039, 0.31160784],
          ],
          requires_grad=True,
      )
  
      # Create symmetric square kernel matrix (for training)
      K = qml.kernels.square_kernel_matrix(X_train, kernel)
  
      # Add some (symmetric) Gaussian noise to the kernel matrix.
      N = qml.numpy.tensor(
          [[-2.33010045, -2.22195441], [-0.40680862, 0.21785961]],
          requires_grad=True,
      )
      K += (N + N.T) / 2
      with pytest.raises(
          ValueError,
          match="The average noise mitigation method cannot be applied",
      ):
          qml.kernels.mitigate_depolarizing_noise(
              K, num_wires, method="average"
          )
  
imports: import math
  import sys
  from functools import partial
  import pytest
  import numpy
  import pennylane
  import pennylane.kernels
  from pennylane import numpy
label_desc: Use image node_id 2 for calling the TestErrorForNonRealistic obj's underlying member method code with example usage: obj.test_mitigate_depolarizing_noise_average_method_error() and returns: qml, kernel_circuit