class_docstr: Unit tests for the properties of the HardwareHamiltonian class.
class_docstr_tok: ["Unit","tests","for","the","properties","of","the","HardwareHamiltonian","class","."]
docstr: Test that the __add__ dunder method works correctly.
docstr_tok: ["Test","that","the","__add__","dunder","method","works","correctly","."]
code: def test_add_hardware_hamiltonian(self, settings):
      """Test that the __add__ dunder method works correctly."""
      rm1 = HardwareHamiltonian(
          coeffs=[1, 2],
          observables=[qml.PauliX(4), qml.PauliZ(8)],
          pulses=[HardwarePulse(1, 2, 3, [4, 8])],
          settings=settings,
          reorder_fn=_reorder_parameters,
      )
      rm2 = HardwareHamiltonian(
          coeffs=[2],
          observables=[qml.PauliY(8)],
          pulses=[HardwarePulse(5, 6, 7, 8)],
          reorder_fn=_reorder_parameters,
      )
  
      sum_rm = rm1 + rm2
  
      assert isinstance(sum_rm, HardwareHamiltonian)
      assert qml.math.allequal(sum_rm.coeffs, [1, 2, 2])
      assert all(
          qml.equal(op1, op2)
          for op1, op2 in zip(
              sum_rm.ops, [qml.PauliX(4), qml.PauliZ(8), qml.PauliY(8)]
          )
      )
      assert sum_rm.pulses == [
          HardwarePulse(1, 2, 3, [4, 8]),
          HardwarePulse(5, 6, 7, 8),
      ]
      assert sum_rm.settings == settings
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.pulse import HardwareHamiltonian, drive, rydberg_interaction
  from pennylane.pulse.hardware_hamiltonian import HardwarePulse, AmplitudeAndPhase, amplitude_and_phase, _reorder_parameters
  from pennylane.pulse.transmon import TransmonSettings
  from pennylane.pulse.rydberg import RydbergSettings
  from pennylane.wires import Wires
label_desc: Use image node_id 3 for calling the TestHardwareHamiltonian obj's underlying member method code with example usage: obj.test_add_hardware_hamiltonian(settings) without return types