@@ -97,7 +97,10 @@ def test_ionq_client_create_job(mock_post):
97
97
98
98
client = ionq .ionq_client ._IonQClient (remote_host = 'http://example.com' , api_key = 'to_my_heart' )
99
99
program = ionq .SerializedProgram (
100
- body = {'job' : 'mine' }, metadata = {'a' : '0,1' }, error_mitigation = {'debias' : True }
100
+ body = {'job' : 'mine' },
101
+ metadata = {'a' : '0,1' },
102
+ settings = {'aaa' : 'bb' },
103
+ error_mitigation = {'debias' : True },
101
104
)
102
105
response = client .create_job (
103
106
serialized_program = program , repetitions = 200 , target = 'qpu' , name = 'bacon'
@@ -109,9 +112,10 @@ def test_ionq_client_create_job(mock_post):
109
112
'lang' : 'json' ,
110
113
'body' : {'job' : 'mine' },
111
114
'name' : 'bacon' ,
115
+ 'metadata' : {'shots' : '200' , 'a' : '0,1' },
116
+ 'settings' : {'aaa' : 'bb' },
112
117
'shots' : '200' ,
113
118
'error_mitigation' : {'debias' : True },
114
- 'metadata' : {'shots' : '200' , 'a' : '0,1' },
115
119
}
116
120
expected_headers = {
117
121
'Authorization' : 'apiKey to_my_heart' ,
@@ -129,7 +133,7 @@ def test_ionq_client_create_job_extra_params(mock_post):
129
133
mock_post .return_value .json .return_value = {'foo' : 'bar' }
130
134
131
135
client = ionq .ionq_client ._IonQClient (remote_host = 'http://example.com' , api_key = 'to_my_heart' )
132
- program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {'a' : '0,1' })
136
+ program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {'a' : '0,1' }, settings = {} )
133
137
response = client .create_job (
134
138
serialized_program = program ,
135
139
repetitions = 200 ,
@@ -166,7 +170,7 @@ def test_ionq_client_create_job_default_target(mock_post):
166
170
client = ionq .ionq_client ._IonQClient (
167
171
remote_host = 'http://example.com' , api_key = 'to_my_heart' , default_target = 'simulator'
168
172
)
169
- _ = client .create_job (ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {}))
173
+ _ = client .create_job (ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {}, settings = {} ))
170
174
assert mock_post .call_args [1 ]['json' ]['target' ] == 'simulator'
171
175
172
176
@@ -179,7 +183,7 @@ def test_ionq_client_create_job_target_overrides_default_target(mock_post):
179
183
remote_host = 'http://example.com' , api_key = 'to_my_heart' , default_target = 'simulator'
180
184
)
181
185
_ = client .create_job (
182
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {}),
186
+ serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {}, settings = {} ),
183
187
target = 'qpu' ,
184
188
repetitions = 1 ,
185
189
)
@@ -190,7 +194,9 @@ def test_ionq_client_create_job_no_targets():
190
194
client = ionq .ionq_client ._IonQClient (remote_host = 'http://example.com' , api_key = 'to_my_heart' )
191
195
with pytest .raises (AssertionError , match = 'neither were set' ):
192
196
_ = client .create_job (
193
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {})
197
+ serialized_program = ionq .SerializedProgram (
198
+ body = {'job' : 'mine' }, metadata = {}, settings = {}
199
+ )
194
200
)
195
201
196
202
@@ -204,7 +210,9 @@ def test_ionq_client_create_job_unauthorized(mock_post):
204
210
)
205
211
with pytest .raises (ionq .IonQException , match = 'Not authorized' ):
206
212
_ = client .create_job (
207
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {})
213
+ serialized_program = ionq .SerializedProgram (
214
+ body = {'job' : 'mine' }, metadata = {}, settings = {}
215
+ )
208
216
)
209
217
210
218
@@ -218,7 +226,9 @@ def test_ionq_client_create_job_not_found(mock_post):
218
226
)
219
227
with pytest .raises (ionq .IonQNotFoundException , match = 'not find' ):
220
228
_ = client .create_job (
221
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {})
229
+ serialized_program = ionq .SerializedProgram (
230
+ body = {'job' : 'mine' }, metadata = {}, settings = {}
231
+ )
222
232
)
223
233
224
234
@@ -232,7 +242,9 @@ def test_ionq_client_create_job_not_retriable(mock_post):
232
242
)
233
243
with pytest .raises (ionq .IonQException , match = 'Status: 409' ):
234
244
_ = client .create_job (
235
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {})
245
+ serialized_program = ionq .SerializedProgram (
246
+ body = {'job' : 'mine' }, metadata = {}, settings = {}
247
+ )
236
248
)
237
249
238
250
@@ -253,7 +265,9 @@ def test_ionq_client_create_job_retry(mock_post):
253
265
test_stdout = io .StringIO ()
254
266
with contextlib .redirect_stdout (test_stdout ):
255
267
_ = client .create_job (
256
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {})
268
+ serialized_program = ionq .SerializedProgram (
269
+ body = {'job' : 'mine' }, metadata = {}, settings = {}
270
+ )
257
271
)
258
272
assert test_stdout .getvalue ().strip () == 'Waiting 0.1 seconds before retrying.'
259
273
assert mock_post .call_count == 2
@@ -268,7 +282,7 @@ def test_ionq_client_create_job_retry_request_error(mock_post):
268
282
remote_host = 'http://example.com' , api_key = 'to_my_heart' , default_target = 'simulator'
269
283
)
270
284
_ = client .create_job (
271
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {})
285
+ serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {}, settings = {} )
272
286
)
273
287
assert mock_post .call_count == 2
274
288
@@ -286,7 +300,9 @@ def test_ionq_client_create_job_timeout(mock_post):
286
300
)
287
301
with pytest .raises (TimeoutError ):
288
302
_ = client .create_job (
289
- serialized_program = ionq .SerializedProgram (body = {'job' : 'mine' }, metadata = {})
303
+ serialized_program = ionq .SerializedProgram (
304
+ body = {'job' : 'mine' }, metadata = {}, settings = {}
305
+ )
290
306
)
291
307
292
308
0 commit comments