Skip to content

Commit

Permalink
add test with simplify()
Browse files Browse the repository at this point in the history
  • Loading branch information
aeddins-ibm committed Aug 7, 2024
1 parent 50636fa commit 616e376
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,12 @@ def test_paulis_setter_absorbs_phase(self):
self.assertTrue(np.allclose(op.coeffs, coeffs_init * np.array([-1j, 1j])))
# The phase of the input array is now zero:
self.assertTrue(np.allclose(paulis_new.phase, np.array([0, 0])))

def test_paulis_setter_absorbs_phase_2(self):
"""Test that `paulis` setter followed by `simplify()` handle phase OK."""
spo = SparsePauliOp(['X', 'X'])
spo.paulis = ['X','-X']
self.assertEqual(spo.simplify(), SparsePauliOp(['I'], coeffs=[0.+0.j]))

def test_apply_layout_with_transpile(self):
"""Test the apply_layout method with a transpiler layout."""
Expand Down

0 comments on commit 616e376

Please sign in to comment.