From 5c7fcb6751215730ac85802d2e52545e3488de91 Mon Sep 17 00:00:00 2001 From: Kevin Tian Date: Wed, 13 Mar 2024 14:00:34 -0400 Subject: [PATCH] Fix test_estimator_v2 (#1503) * Fix test_estimator_v2 * update test_backend_serialization --- test/integration/test_backend_serialization.py | 3 ++- test/integration/test_estimator_v2.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/integration/test_backend_serialization.py b/test/integration/test_backend_serialization.py index b97d81053..43a3c4773 100644 --- a/test/integration/test_backend_serialization.py +++ b/test/integration/test_backend_serialization.py @@ -76,7 +76,8 @@ def test_backend_properties(self, service): for backend in backends: with self.subTest(backend=backend): properties = backend.properties() - self._verify_data(properties.to_dict(), good_keys) + if properties: + self._verify_data(properties.to_dict(), good_keys) def _verify_data( self, data: Dict, good_keys: tuple, good_key_prefixes: Optional[tuple] = None diff --git a/test/integration/test_estimator_v2.py b/test/integration/test_estimator_v2.py index d9d84dcfd..741b802ae 100644 --- a/test/integration/test_estimator_v2.py +++ b/test/integration/test_estimator_v2.py @@ -60,11 +60,11 @@ def test_estimator_v2_session(self, service): job2 = estimator.run([(psi1, [H1, H3], [theta1, theta3]), (psi2, H2, theta2)]) result2 = job2.result() - self._verify_result_type(result2, num_pubs=2, shapes=[(2,), (1,)]) + self._verify_result_type(result2, num_pubs=2, shapes=[(2,), ()]) job3 = estimator.run([(psi1, H1, theta1), (psi2, H2, theta2), (psi1, H3, theta3)]) result3 = job3.result() - self._verify_result_type(result3, num_pubs=3, shapes=[(1,), (1,), (1,)]) + self._verify_result_type(result3, num_pubs=3, shapes=[(), (), ()]) @run_integration_test def test_estimator_v2_options(self, service): @@ -101,7 +101,7 @@ def test_estimator_v2_options(self, service): job = estimator.run([(circuit, observables)]) result = job.result() - self._verify_result_type(result, num_pubs=1, shapes=[(1,)]) + self._verify_result_type(result, num_pubs=1, shapes=[()]) self.assertEqual(result[0].metadata["shots"], 1600) for res_key in ["twirled_readout_errors", "zne_noise_factors"]: self.assertIn(res_key, result[0].metadata["resilience"])