Skip to content

Commit 5d62d6c

Browse files
authored
fix: handle in test for local sim that supports program sets (#308)
1 parent 32ab2c3 commit 5d62d6c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/unit_tests/test_braket_device.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@
9898
.sample(observable=observables.Z(3))
9999
)
100100

101+
# Circuit with basis rotations for `CIRCUIT` when using program sets
102+
CIRCUIT_WITH_BASIS_ROTATION = (
103+
Circuit()
104+
.h(0)
105+
.cnot(0, 1)
106+
.i(2)
107+
.i(3)
108+
.ry(1, -np.pi / 2) # Basis rotation gate for PauliX(1)
109+
.rx(2, np.pi / 2) # Basis rotation gate for PauliY(2)
110+
)
111+
101112
CIRCUIT_BELL = Circuit().h(0).cnot(0, 1)
102113
PROGRAM_RESULT = {
103114
"braketSchemaHeader": {
@@ -1204,8 +1215,13 @@ def test_local_sim_batch_execute_parallel(mock_run_batch):
12041215
RESULT.get_value_by_result_type(result_types.Sample(observable=observables.Z(3))),
12051216
)
12061217

1218+
if dev._supports_program_sets:
1219+
expected_circuits = [CIRCUIT_WITH_BASIS_ROTATION, CIRCUIT_WITH_BASIS_ROTATION]
1220+
else:
1221+
expected_circuits = [CIRCUIT, CIRCUIT]
1222+
12071223
mock_run_batch.assert_called_with(
1208-
[CIRCUIT, CIRCUIT],
1224+
expected_circuits,
12091225
shots=SHOTS,
12101226
max_parallel=None,
12111227
inputs=[],

0 commit comments

Comments
 (0)