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 6c2b1b4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/local/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List

import numpy as np
import pytest
from qiskit import QuantumCircuit, transpile
from qiskit.circuit.library import Initialize

Expand Down Expand Up @@ -43,6 +44,17 @@ def test_set_execution_backend_options() -> None:
assert sum(backend.run(transpiled).result().get_counts().values()) == 7


def test_run_override_nbar_error() -> None:
"""
Test that passing average_nb_photons option to backend.run() is not allowed
"""
circ = QuantumCircuit(1, 1)
backend = ProcessorSimulator(PhysicalCatProcessor())
transpiled = transpile(circ, backend)
with pytest.raises(ValueError):
_ = backend.run(transpiled, shots=100, average_nb_photons=4)


def test_translation_plugin() -> None:
backend = ProcessorSimulator(SimpleProcessor(1))

Expand Down

0 comments on commit 6c2b1b4

Please sign in to comment.