diff --git a/qiskit_alice_bob_provider/remote/backend.py b/qiskit_alice_bob_provider/remote/backend.py index 9da09cb..dfc55e1 100644 --- a/qiskit_alice_bob_provider/remote/backend.py +++ b/qiskit_alice_bob_provider/remote/backend.py @@ -100,6 +100,14 @@ def run(self, run_input: QuantumCircuit, **kwargs) -> AliceBobRemoteJob: Wait for the results by calling :func:`AliceBobRemoteJob.result`. """ + if not isinstance(run_input, QuantumCircuit): + # Qiskit's execute() allows also for list[QuantumCircuit], + # Schedule and list[Schedule] as inputs. These types of experiments + # are not yet handled by the provider. + raise NotImplementedError( + 'Experiments input not supported by the Alice & Bob provider. ' + 'Please provide an instance of QuantumCircuit.' + ) if self._verbose: write_current_line('Sending circuit to the API...') options = self.update_options(kwargs) diff --git a/tests/remote/test_backend.py b/tests/remote/test_backend.py index dd274f7..97e1888 100644 --- a/tests/remote/test_backend.py +++ b/tests/remote/test_backend.py @@ -22,6 +22,7 @@ import pytest from qiskit import QiskitError, QuantumCircuit, execute, transpile from qiskit.providers import Options +from qiskit.pulse.schedule import Schedule from qiskit.result import Result from qiskit.transpiler.exceptions import TranspilerError from requests_mock.mocker import Mocker @@ -92,6 +93,21 @@ def test_too_many_qubits_clients_side(mocked_targets) -> None: execute(c, backend) +def test_input_not_quantum_circuit(mocked_targets) -> None: + c1 = QuantumCircuit(1, 1) + c2 = QuantumCircuit(1, 1) + s1 = Schedule() + s2 = Schedule() + provider = AliceBobRemoteProvider(api_key='foo') + backend = provider.get_backend('EMU:1Q:LESCANNE_2020') + with pytest.raises(NotImplementedError): + execute([c1, c2], backend) + with pytest.raises(NotImplementedError): + execute(s1, backend) + with pytest.raises(NotImplementedError): + execute([s1, s2], backend) + + def test_counts_ordering(successful_job: Mocker) -> None: c = QuantumCircuit(1, 2) c.initialize('+', 0)