Skip to content

Commit

Permalink
Merge pull request #24 from zapatacomputing/zqs-1202-upgrade-qiskit
Browse files Browse the repository at this point in the history
fix(backend_test): make tests deterministic
  • Loading branch information
Athena Caesura authored Oct 5, 2022
2 parents 5e8587f + 102cfe5 commit bec3379
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def pickle_jobs_and_batches_with_different_qubits():
for job in jobs:
job.result()

# we dont care about the results, we just want to pickle the jobs object
jobs[0].result().results[0].data.counts["0x9"] = n_samples

with open(
os.path.join(file_path, "jobs_and_batches_with_different_qubits.pickle"), "wb"
) as f:
Expand Down
10 changes: 6 additions & 4 deletions tests/orquestra/integrations/qiskit/backend/backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ def test_aggregate_measurements_extracts_correct_qubits(
)

# Then
if backend_with_readout_correction.noise_inversion_method == "pseudo_inverse":
assert results[0].get_counts() == {"0000": 1, "1001": 48, "1101": 1}
else:
assert results[0].get_counts() == {"1001": 48}
lst = backend_with_readout_correction.list_virtual_to_physical_qubits_dict
assert len(lst) == 1
# ensure jobs and batches had different qubits which had to be remapped
assert lst[0] != {0: 0, 1: 1, 2: 2, 3: 3, 4: 4}
if backend_with_readout_correction.noise_inversion_method != "pseudo_inverse":
assert results[0].get_counts() == {"1001": 50}

def test_run_circuitset_and_measure(self, backend):
# Given
Expand Down
Binary file not shown.

0 comments on commit bec3379

Please sign in to comment.