Skip to content

Commit

Permalink
Add test workaround from level 3 to level 2 too
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Apr 5, 2024
1 parent 8191110 commit d263471
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/python/compiler/test_transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1831,11 +1831,12 @@ def test_synthesis_translation_method_with_gates_outside_basis(self, optimizatio
optimization_level=optimization_level,
seed_transpiler=42,
)
if optimization_level != 3:
if optimization_level not in {2, 3}:
self.assertTrue(Operator(qc).equiv(res))
self.assertNotIn("swap", res.count_ops())
else:
# Optimization level 3 eliminates the pointless swap
# Optimization level 2 and 3 eliminates the swap by permuting the
# qubits
self.assertEqual(res, QuantumCircuit(2))

@data(0, 1, 2, 3)
Expand Down

0 comments on commit d263471

Please sign in to comment.