class_docstr: Tests for the mitigate_with_zne function
class_docstr_tok: ["Tests","for","the","mitigate_with_zne","function"]
docstr: Tests if mitigation proceeds as expected when reps_per_factor is not 1 (default)
docstr_tok: ["Tests","if","mitigation","proceeds","as","expected","when","reps_per_factor","is","not","1","(","default",")"]
code: def test_reps_per_factor_not_1(self, mocker):
      """Tests if mitigation proceeds as expected when reps_per_factor is not 1 (default)"""
      scale_factors = [1, 2, -4]
      spy_fold = mocker.spy(self, "folding")
      spy_extrapolate = mocker.spy(self, "extrapolate")
      _, fn = mitigate_with_zne(
          tape,
          scale_factors,
          self.folding,
          self.extrapolate,
          reps_per_factor=2,
      )
      random_results = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
  
      args = spy_fold.call_args_list
      for i in range(6):
          same_tape(args[i][0][0], tape_base)
      assert [args[i][0][1] for i in range(6)] == [1, 1, 2, 2, -4, -4]
  
      fn(random_results)
  
      args = spy_extrapolate.call_args
  
      assert args[0][0] == scale_factors
      assert np.allclose(
          args[0][1],
          np.mean(np.reshape(random_results, (3, 2)), axis=1),
      )
  
imports: from functools import partial
  import pytest
  from packaging import version
  import pennylane
  from pennylane import numpy
  from pennylane.tape import QuantumScript
  from pennylane.transforms import mitigate_with_zne, richardson_extrapolate, fold_global
label_desc: Use image node_id 4 for calling the TestMitigateWithZNE obj's underlying member method code with example usage: obj.test_reps_per_factor_not_1(mocker) without return types