Skip to content

Commit

Permalink
Refactors test_transpiler_service.py
Browse files Browse the repository at this point in the history
  • Loading branch information
y4izus committed Dec 3, 2024
1 parent 9787dcf commit d89761d
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 98 deletions.
27 changes: 27 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from qiskit_ibm_transpiler.utils import (
create_random_linear_function,
random_clifford_from_linear_function,
get_qpy_from_circuit,
)

from tests.utils import create_random_circuit_with_several_operators
Expand Down Expand Up @@ -58,6 +59,11 @@ def env_set(monkeypatch, request):
logging.getLogger("qiskit_ibm_transpiler.ai.synthesis").setLevel(logging.DEBUG)


@pytest.fixture(scope="module")
def non_valid_backend_name():
return "ibm_torin"


@pytest.fixture(scope="module")
def brisbane_backend_name():
return "ibm_brisbane"
Expand Down Expand Up @@ -85,6 +91,16 @@ def brisbane_num_qubits(brisbane_backend):
return brisbane_backend.num_qubits


@pytest.fixture(scope="module")
def qpy_circuit_with_transpiling_error():
return "UUlTS0lUDAECAAAAAAAAAAABZXEAC2YACAAAAAMAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAYAAAAAY2lyY3VpdC0xNjAAAAAAAAAAAHt9cQEAAAADAAEBcQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAABACRnAAAAAgAAAAABAAAAAAAAALsAAAAAAAAAAAAAAAAAAAAAZGN4X2ZkN2JlNTcxOTQ1OTRkZTY5ZDFlMTNmNmFmYmY1NmZjAAtmAAgAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAGNpcmN1aXQtMTYxAAAAAAAAAAB7fQAAAAAAAAAAAAYAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAEAAAABQ1hHYXRlcQAAAABxAAAAAQAGAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAABAAAAAUNYR2F0ZXEAAAABcQAAAAAAAAD///////////////8AAAAAAAAAAAAGAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAABAAAAAUNaR2F0ZXEAAAAAcQAAAAIABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABTZGdHYXRlcQAAAAEAJAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkY3hfZmQ3YmU1NzE5NDU5NGRlNjlkMWUxM2Y2YWZiZjU2ZmNxAAAAAnEAAAABAAYAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVTNHYXRlcQAAAABmAAAAAAAAAAiMHTg9AR8PQGYAAAAAAAAACH+xa3jilAtAZgAAAAAAAAAItmSFHpiI8j8ABwAAAAEAAAACAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFDUlhHYXRlcQAAAAFxAAAAAGYAAAAAAAAACI2Sd1JN3gJAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWUdhdGVxAAAAAgAAAP///////////////wAAAAAAAAAA"


@pytest.fixture(scope="module")
def non_valid_qpy_circuit(basic_cnot_circuit):
return [get_qpy_from_circuit(basic_cnot_circuit)] * 2


@pytest.fixture(scope="module")
def permutation_circuit_brisbane(brisbane_num_qubits):
orig_qc = QuantumCircuit(brisbane_num_qubits)
Expand Down Expand Up @@ -189,3 +205,14 @@ def basic_swap_circuit():
circuit.swap(1, 2)

return circuit


@pytest.fixture(scope="module")
def circuit_with_barrier():
circuit = QuantumCircuit(5)
circuit.x(4)
circuit.barrier()
circuit.z(3)
circuit.cx(3, 4)

return circuit
2 changes: 2 additions & 0 deletions tests/test_ai_synthesis_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def test_ai_cloud_synthesis_unexisting_url(
assert isinstance(ai_optimized_circuit, QuantumCircuit)


# TODO: Review why if I remove max_block_size=27 from the collector_pass, Permutation
# test fails
@parametrize_complex_circuit_collector_pass_and_ai_synthesis_pass()
@parametrize_local_mode()
def test_ai_synthesis_always_replace_original_circuit(
Expand Down
Loading

0 comments on commit d89761d

Please sign in to comment.