class_docstr: Unit tests for the properties of the HardwareHamiltonian class.
class_docstr_tok: ["Unit","tests","for","the","properties","of","the","HardwareHamiltonian","class","."]
docstr: Tests that adding a `HardwareHamiltonian` and `ParametrizedHamiltonian` works as
  expected.
docstr_tok: ["Tests","that","adding","a","`","HardwareHamiltonian","`","and","`","ParametrizedHamiltonian","`","works","as","expected","."]
code: def test_add_parametrized_hamiltonian(self):
      """Tests that adding a `HardwareHamiltonian` and `ParametrizedHamiltonian` works as
      expected."""
      coeffs = [2, 3]
      ops = [qml.PauliZ(0), qml.PauliX(2)]
      h_wires = [0, 2]
  
      rh = HardwareHamiltonian(
          coeffs=[coeffs[0]],
          observables=[ops[0]],
          pulses=[HardwarePulse(5, 6, 7, 8)],
      )
      ph = qml.pulse.ParametrizedHamiltonian(
          coeffs=[coeffs[1]], observables=[ops[1]]
      )
  
      res1 = rh + ph
      res2 = ph + rh
  
      assert isinstance(res1, HardwareHamiltonian)
      assert res1.coeffs_fixed == coeffs
      assert res1.coeffs_parametrized == []
      assert all(
          qml.equal(op1, op2) for op1, op2 in zip(res1.ops_fixed, ops)
      )
      assert res1.ops_parametrized == []
      assert res1.wires == qml.wires.Wires(h_wires)
  
      coeffs.reverse()
      ops.reverse()
      h_wires.reverse()
  
      assert isinstance(res2, HardwareHamiltonian)
      assert res2.coeffs_fixed == coeffs
      assert res2.coeffs_parametrized == []
      assert all(
          qml.equal(op1, op2) for op1, op2 in zip(res2.ops_fixed, ops)
      )
      assert res2.ops_parametrized == []
      assert res2.wires == qml.wires.Wires(h_wires)
  
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 5 for calling the TestHardwareHamiltonian obj's underlying member method code with example usage: obj.test_add_parametrized_hamiltonian() without return types