diff --git a/tests/local/test_provider.py b/tests/local/test_provider.py index 5ff9ecb..125339e 100644 --- a/tests/local/test_provider.py +++ b/tests/local/test_provider.py @@ -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 @@ -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)