Skip to content

Commit

Permalink
Use assertion in tests with better diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
jlapeyre committed Jul 12, 2023
1 parent 8bea1e7 commit 87b979e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/python/transpiler/test_consolidate_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,10 @@ def test_not_crossing_between_control_flow_ops(self):
op_false1 = qc_out[0].operation.blocks[1][0].operation
op_true2 = qc_out[1].operation.blocks[0][0].operation
op_false2 = qc_out[1].operation.blocks[1][0].operation
self.assertTrue(np.alltrue(CXGate().to_matrix() == op_true1.to_matrix()))
self.assertTrue(np.alltrue(CZGate().to_matrix() == op_false1.to_matrix()))
self.assertTrue(np.alltrue(CXGate().to_matrix() == op_true2.to_matrix()))
self.assertTrue(np.alltrue(CZGate().to_matrix() == op_false2.to_matrix()))
np.testing.assert_allclose(CXGate().to_matrix(), op_true1.to_matrix())
np.testing.assert_allclose(CZGate().to_matrix(), op_false1.to_matrix())
np.testing.assert_allclose(CXGate().to_matrix(), op_true2.to_matrix())
np.testing.assert_allclose(CZGate().to_matrix(), op_false2.to_matrix())


if __name__ == "__main__":
Expand Down

0 comments on commit 87b979e

Please sign in to comment.