Skip to content

Commit

Permalink
remove error if measure targets are outside circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
ashlhans committed Mar 29, 2024
1 parent 70a9e05 commit 98e89dc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/braket/circuits/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,6 @@ def measure(self, target_qubits: QubitSetInput | None = None) -> Circuit:
if isinstance(target_qubits, int):
target_qubits = [target_qubits]

# Check that the target qubits are on the circuit
if target_qubits and not all(qubit in self.qubits for qubit in target_qubits):
raise IndexError("Target qubits must be within the range of the current circuit.")

# Check if result types are added on the circuit
if self.result_types:
raise ValueError("a circuit cannot contain both measure instructions and result types.")
Expand Down
5 changes: 0 additions & 5 deletions test/unit_tests/braket/circuits/test_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,6 @@ def test_measure_in_verbatim_subcircuit():
Circuit().add_verbatim_box(Circuit().x(0).x(1).measure(0))


def test_measure_qubits_out_of_range():
with pytest.raises(IndexError):
Circuit().h(0).cnot(0, 1).measure([4])


def test_measure_empty_circuit():
with pytest.raises(IndexError):
Circuit().measure()
Expand Down

0 comments on commit 98e89dc

Please sign in to comment.