class_docstr: Tests `_iterate_shift_rule_with_multipliers` to produce the correct rules.
class_docstr_tok: ["Tests","`","_iterate_shift_rule_with_multipliers","`","to","produce","the","correct","rules","."]
docstr: Test third order iteration of a rule with multipliers.
code: def test_third_order(self, period):
      """Test third order iteration of a rule with multipliers."""
      rule = [(0.2, 1.2, 0.4), (-0.9, 0.7, -0.2)]
      iterated_rule = _iterate_shift_rule_with_multipliers(
          rule, 3, period
      )
      expected = np.array(
          [
              [0.2**3, 1.2**3, (0.4 * 1.2 + 0.4) * 1.2 + 0.4],
              [
                  0.2**2 * -0.9,
                  1.2**2 * 0.7,
                  (0.4 * 1.2 + 0.4) * 0.7 - 0.2,
              ],
              [
                  0.2 * -0.9 * 0.2,
                  1.2 * 0.7 * 1.2,
                  (0.4 * 0.7 - 0.2) * 1.2 + 0.4,
              ],
              [
                  0.2 * (-0.9) ** 2,
                  1.2 * 0.7**2,
                  (0.4 * 0.7 - 0.2) * 0.7 - 0.2,
              ],
              [
                  -0.9 * 0.2**2,
                  0.7 * 1.2**2,
                  (-0.2 * 1.2 + 0.4) * 1.2 + 0.4,
              ],
              [
                  -0.9 * 0.2 * -0.9,
                  0.7 * 1.2 * 0.7,
                  (-0.2 * 1.2 + 0.4) * 0.7 - 0.2,
              ],
              [
                  (-0.9) ** 2 * 0.2,
                  0.7**2 * 1.2,
                  (-0.2 * 0.7 - 0.2) * 1.2 + 0.4,
              ],
              [(-0.9) ** 3, 0.7**3, (-0.2 * 0.7 - 0.2) * 0.7 - 0.2],
          ]
      )
      if period == np.pi / 3:
          expected[0, -1] -= period
          expected[4, -1] -= period
  
      assert np.allclose(iterated_rule, expected)
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.gradients.general_shift_rules import eigvals_to_frequencies, frequencies_to_period, generate_shift_rule, _get_shift_rule, generate_multi_shift_rule, generate_shifted_tapes, generate_multishifted_tapes, _iterate_shift_rule_with_multipliers
label_desc: Use image node_id 3 for calling the TestIterateShiftRuleWithMultipliers obj's underlying member method code with example usage: obj.test_third_order(period) without return types