Skip to content

Commit c48e970

Browse files
committed
Test: Add test
1 parent ded7cbd commit c48e970

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/python/transpiler/test_basis_translator.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,3 +1314,27 @@ def test_basis_nested_control_flow_op_aer(self):
13141314
pass
13151315

13161316
self.assertEqual(transpiled, expected)
1317+
1318+
@unittest.skipUnless(HAS_AER, "Aer backend required for simulation")
1319+
def test_basis_with_unitary_basis_aer(self):
1320+
"""Test that a circuit with a unitary gate in its target basis gets
1321+
skipped by the BasisTranslator"""
1322+
from qiskit_aer import AerSimulator
1323+
1324+
qr = QuantumRegister(3, "q")
1325+
cr = ClassicalRegister(3, "c")
1326+
qc = QuantumCircuit(qr, cr)
1327+
1328+
qc.cx(0, 1)
1329+
qc.h(0)
1330+
qc.cx(0, 1)
1331+
qc.sx(0)
1332+
qc.dcx(0, 2)
1333+
1334+
backend = AerSimulator()
1335+
pm = generate_preset_pass_manager(
1336+
optimization_level=2, backend=backend, seed_transpiler=134
1337+
)
1338+
transpiled = pm.run(qc)
1339+
1340+
self.assertEqual(Operator(qc), Operator(transpiled))

0 commit comments

Comments
 (0)