Skip to content

Commit

Permalink
test: passing average_nb_photons option to backend.run() is not allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
gschurck committed Nov 7, 2024
1 parent 4265dde commit 739db20
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/local/test_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from qiskit import QuantumCircuit, transpile

from qiskit_alice_bob_provider.local.backend import ProcessorSimulator
from qiskit_alice_bob_provider.local.provider import AliceBobLocalProvider
Expand Down Expand Up @@ -26,3 +27,21 @@ def test_get_backend_change_nbar() -> None:
proc = backend.target.durations()._proc
assert isinstance(proc, PhysicalCatProcessor)
assert proc._average_nb_photons == pytest.approx(9)


def test_run_override_nbar_error() -> None:
"""
Test that passing average_nb_photons option to backend.run() is not allowed
"""
ab = AliceBobLocalProvider()

circ = QuantumCircuit(1, 1)
circ.reset(0)
circ.delay(30, 0, unit='us')
circ.measure(0, 0)

backend = ab.get_backend('EMU:6Q:PHYSICAL_CATS')
transpiled_circ = transpile(circ, backend)

with pytest.raises(ValueError):
_ = backend.run(transpiled_circ, shots=100, average_nb_photons=4)

0 comments on commit 739db20

Please sign in to comment.