Skip to content

Commit

Permalink
Update test_transpile.py
Browse files Browse the repository at this point in the history
  • Loading branch information
salmma committed Oct 4, 2024
1 parent 8a279f3 commit b808aa1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/test_transpile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from app.config import basedir
from app import app, db
import qiskit
from qiskit import qasm2
import base64
from qiskit.circuit.random import random_circuit

Expand Down Expand Up @@ -52,8 +53,8 @@ def test_version(self):
def test_transpile_hadamard_simulator_url(self):
# prepare the request
request = {'impl-url': "https://raw.githubusercontent.com/PlanQK/qiskit-service/master/test/data/hadamard.py",
'impl-language': 'Qiskit', 'qpu-name': "ibmq_qasm_simulator", 'input-params': {},
'token': os.environ["QISKIT_TOKEN"]}
'impl-language': 'Qiskit', 'qpu-name': "ibmq_qasm_simulator", 'input-params': {},
'token': os.environ["QISKIT_TOKEN"]}

# send the request
response = self.client.post('/qiskit-service/api/v1.0/transpile', json=request)
Expand Down Expand Up @@ -83,7 +84,7 @@ def test_transpile_hadamard_simulator_file(self):
with open(file_path, 'rb') as f:
impl_data = base64.b64encode(f.read()).decode()
request = {'impl-data': impl_data, 'impl-language': 'Qiskit', 'qpu-name': "ibmq_qasm_simulator",
'input-params': {}, 'token': os.environ["QISKIT_TOKEN"]}
'input-params': {}, 'token': os.environ["QISKIT_TOKEN"]}

# send the request
response = self.client.post('/qiskit-service/api/v1.0/transpile', json=request)
Expand Down Expand Up @@ -113,7 +114,7 @@ def test_transpile_circuit_sim_file(self):
with open(file_path, 'rb') as f:
impl_data = base64.b64encode(f.read()).decode()
request = {'impl-data': impl_data, 'impl-language': 'openqasm', 'qpu-name': "ibmq_qasm_simulator",
'input-params': {}, 'token': os.environ.get("QISKIT_TOKEN", "")}
'input-params': {}, 'token': os.environ.get("QISKIT_TOKEN", "")}

# send the request
response = self.client.post('/qiskit-service/api/v1.0/transpile', json=request)
Expand All @@ -140,8 +141,8 @@ def test_transpile_circuit_sim_file(self):
def test_transpile_shor_sim_url_qasm(self):
# prepare the request
request = {'impl-url': 'https://quantum-circuit.com/api/get/circuit/KzG7MxH6hpBpM9pCt?format=qasm',
'impl-language': 'OpenQASM', 'qpu-name': "ibmq_qasm_simulator", 'input-params': {},
'token': os.environ["QISKIT_TOKEN"]}
'impl-language': 'OpenQASM', 'qpu-name': "ibmq_qasm_simulator", 'input-params': {},
'token': os.environ["QISKIT_TOKEN"]}

# send the request
response = self.client.post('/qiskit-service/api/v1.0/transpile', json=request)
Expand Down Expand Up @@ -207,7 +208,7 @@ def test_transpile_circuit_sim_file_qasm(self):
with open(file_path, 'rb') as f:
impl_data = base64.b64encode(f.read()).decode()
request = {'impl-data': impl_data, 'impl-language': 'OpenQASM', 'qpu-name': "ibmq_qasm_simulator",
'input-params': {}, 'token': os.environ["QISKIT_TOKEN"]}
'input-params': {}, 'token': os.environ["QISKIT_TOKEN"]}

# send the request
response = self.client.post('/qiskit-service/api/v1.0/transpile', json=request)
Expand Down Expand Up @@ -330,7 +331,7 @@ def test_batch_execution(self):
circs.append(qasm2.dumps(random_circuit(num_qubits=5, depth=4, measure=True)))

request = {'impl-qasm': circs, 'impl-language': 'Qiskit', 'qpu-name': "ibmq_qasm_simulator", 'input-params': {},
'token': os.environ["QISKIT_TOKEN"]}
'token': os.environ["QISKIT_TOKEN"]}

# send the request
r = self.client.post('/qiskit-service/api/v1.0/execute', json=request)
Expand Down

0 comments on commit b808aa1

Please sign in to comment.