Skip to content

Commit de2b5cc

Browse files
committed
fixing quasi dist return to dict
1 parent 4897f4d commit de2b5cc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

aer_plugin/backends/aer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _exec_quasi_dist(self, circuit: QuantumCircuit) -> Results:
6464
shots = self._get_shots()
6565
result = sampler.run([circuit], shots=shots).result()
6666

67-
return result.quasi_dists[0] # type: ignore[no-any-return]
67+
return dict(result.quasi_dists[0]) # type: ignore[no-any-return]
6868

6969
def run_circuit(self) -> Results:
7070
"""

tests/test_run.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def test_correct_counts(self):
1616
)
1717

1818
assert result.get("0") == 1000
19+
assert isinstance(result, dict)
1920

2021
def test_correct_counts_custom_shots(self):
2122
"""
@@ -27,6 +28,7 @@ def test_correct_counts_custom_shots(self):
2728
)
2829

2930
assert result.get("0") == 120
31+
assert isinstance(result, dict)
3032

3133
def test_incorrect_counts(self):
3234
"""
@@ -45,6 +47,7 @@ def test_correct_quasi_dist(self):
4547
)
4648

4749
assert result.get(0) == 1.0
50+
assert isinstance(result, dict)
4851

4952
def test_correct_quasi_dist_custom_shots(self):
5053
"""
@@ -55,6 +58,7 @@ def test_correct_quasi_dist_custom_shots(self):
5558
)
5659

5760
assert result.get(0) == 1.0
61+
assert isinstance(result, dict)
5862

5963
def test_incorrect_quasi_dist(self):
6064
"""

0 commit comments

Comments
 (0)