From 25e84e1f1a1b7c6ae224997cf447b187188e9594 Mon Sep 17 00:00:00 2001 From: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com> Date: Thu, 19 Jan 2023 18:30:38 +0900 Subject: [PATCH] Remove zero-probability states from Sampler's result (Qiskit/qiskit-terra#9248) * Remove zero probability from Sampler's result * fix TestGrover * add reno * fix a test * round probabilities Co-authored-by: Julien Gacon Co-authored-by: Ikko Hamamura Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- test/test_grover.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_grover.py b/test/test_grover.py index 7f13f733..f0363b6d 100644 --- a/test/test_grover.py +++ b/test/test_grover.py @@ -257,10 +257,11 @@ def test_circuit_result(self, use_sampler): if use_sampler: for i, dist in enumerate(result.circuit_results): keys, values = zip(*sorted(dist.items())) - self.assertTupleEqual(keys, ("00", "01", "10", "11")) if i in (0, 3): - np.testing.assert_allclose(values, [0, 0, 0, 1], atol=0.2) + self.assertTupleEqual(keys, ("11",)) + np.testing.assert_allclose(values, [1], atol=0.2) else: + self.assertTupleEqual(keys, ("00", "01", "10", "11")) np.testing.assert_allclose(values, [0.25, 0.25, 0.25, 0.25], atol=0.2) else: expected_results = [