class_docstr: Test helper functions for the tape text.
docstr: Test private _add_op method functions with a matrix cache.
docstr_tok: ["Test","private","_add_op","method","functions","with","a","matrix","cache","."]
code: def test_add_op_cache(self):
      """Test private _add_op method functions with a matrix cache."""
      cache = {"matrices": []}
      op1 = qml.QubitUnitary(np.eye(2), wires=0)
      assert _add_op(
          op1,
          ["", ""],
          _Config(
              wire_map={0: 0, 1: 1},
              bit_map=default_bit_map,
              cache=cache,
          ),
      ) == ["U(M0)", ""]
  
      assert qml.math.allclose(cache["matrices"][0], np.eye(2))
      op2 = qml.QubitUnitary(np.eye(2), wires=1)
      assert _add_op(
          op2,
          ["", ""],
          _Config(
              wire_map={0: 0, 1: 1},
              bit_map=default_bit_map,
              cache=cache,
          ),
      ) == ["", "U(M0)"]
  
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.drawer import tape_text
  from pennylane.drawer.tape_text import _add_grouping_symbols, _add_cond_grouping_symbols, _add_mid_measure_grouping_symbols, _add_cwire_measurement_grouping_symbols, _add_cwire_measurement, _add_measurement, _add_op, _Config
  from pennylane.tape import QuantumScript, QuantumTape
label_desc: Use image node_id 12 for calling the TestHelperFunctions obj's underlying member method code with example usage: obj.test_add_op_cache() without return types