Skip to content

Commit f1485ac

Browse files
authored
Fix integration Bell circuit fixture so simulator preflight accepts it (#33)
1 parent 7dc7e0a commit f1485ac

5 files changed

Lines changed: 36 additions & 13 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ body = CircuitJobCreationPayload.from_dict({
4747
"shots": 100,
4848
"input": {
4949
"gateset": "qis",
50+
"qubits": 2,
5051
"circuit": [
51-
{"gate": "h", "targets": [0]},
52+
{"gate": "h", "target": 0},
5253
{"gate": "cnot", "control": 0, "target": 1},
5354
],
5455
},

ionq_core/models/qis_circuit_input.py

Lines changed: 8 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi-overlay.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
overlay: 1.0.0
2+
info:
3+
title: ionq-core-python local OpenAPI fixes
4+
version: 0.1.0
5+
description: |
6+
Patches applied to openapi.json before client generation. The upstream
7+
spec marks QisCircuitInput.qubits as optional and floating-point, but
8+
the simulator preflight rejects payloads without it (surfacing as
9+
UnexpectedCompilationError) and qubit counts are non-negative integers.
10+
11+
actions:
12+
- target: $.components.schemas.QisCircuitInput.required
13+
remove: true
14+
- target: $.components.schemas.QisCircuitInput
15+
update:
16+
required:
17+
- circuit
18+
- gateset
19+
- qubits
20+
- target: $.components.schemas.QisCircuitInput.properties.qubits
21+
update:
22+
type: integer
23+
format: int32

tests/integration/test_simulator_job.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
"shots": 100,
2626
"input": {
2727
"gateset": "qis",
28+
"qubits": 2,
2829
"circuit": [
29-
{"gate": "h", "targets": [0]},
30+
{"gate": "h", "target": 0},
3031
{"gate": "cnot", "control": 0, "target": 1},
3132
],
3233
},

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_sync(self, httpx_mock, auth_client):
112112
"type": "ionq.circuit.v1",
113113
"backend": "simulator",
114114
"shots": 100,
115-
"input": {"gateset": "qis", "circuit": [{"gate": "h", "targets": [0]}]},
115+
"input": {"gateset": "qis", "qubits": 1, "circuit": [{"gate": "h", "target": 0}]},
116116
}
117117
)
118118
result = create_job.sync(client=auth_client, body=body)

0 commit comments

Comments
 (0)