Skip to content

Commit

Permalink
Merge branch 'master' into u/maffoo/pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
maffoo committed Mar 29, 2022
2 parents b74ef58 + 06b5a5b commit 76f59ff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cirq-ionq/cirq_ionq/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def results(
f'Job was not completed successfully. Instead had status: {self.status()}'
)
# IonQ returns results in little endian, Cirq prefers to use big endian, so we convert.
if self.target() == 'qpu':
if self.target().startswith('qpu'):
repetitions = self.repetitions()
counts = {
_little_endian_to_big(int(k), self.num_qubits()): int(repetitions * float(v))
Expand Down
14 changes: 14 additions & 0 deletions cirq-ionq/cirq_ionq/job_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ def test_job_results_qpu_endianness():
assert results == ionq.QPUResult({0: 600, 2: 400}, 2, measurement_dict={})


def test_job_results_qpu_target_endianness():
job_dict = {
'id': 'my_id',
'status': 'completed',
'qubits': '2',
'target': 'qpu.target',
'metadata': {'shots': 1000},
'data': {'histogram': {'0': '0.6', '1': '0.4'}},
}
job = ionq.Job(None, job_dict)
results = job.results()
assert results == ionq.QPUResult({0: 600, 2: 400}, 2, measurement_dict={})


@mock.patch('time.sleep', return_value=None)
def test_job_results_poll(mock_sleep):
ready_job = {
Expand Down
3 changes: 1 addition & 2 deletions dev_tools/requirements/deps/format.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
-r flynt.txt
black==21.12b0
click<=8.0.4
black==22.3.0

0 comments on commit 76f59ff

Please sign in to comment.