From 5db25fdb2e8a439358463e948d677c43e82fcd73 Mon Sep 17 00:00:00 2001 From: Ikko Hamamura Date: Wed, 8 Nov 2023 16:16:12 +0900 Subject: [PATCH] Revert too many deprecations in Estimator (#1990) * Revert too much deprecation * fix typo * fix tests --- qiskit_aer/primitives/estimator.py | 12 +++--------- test/terra/primitives/test_estimator.py | 6 ++---- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/qiskit_aer/primitives/estimator.py b/qiskit_aer/primitives/estimator.py index 600a7203d7..df8f10d71c 100644 --- a/qiskit_aer/primitives/estimator.py +++ b/qiskit_aer/primitives/estimator.py @@ -39,7 +39,7 @@ Optimize1qGatesDecomposition, SetLayout, ) -from qiskit.utils import deprecate_arg, deprecate_func +from qiskit.utils import deprecate_func from .. import AerError, AerSimulator @@ -76,12 +76,6 @@ class Estimator(BaseEstimator): normal distribution approximation. """ - @deprecate_arg( - "approximation", - since=0.13, - package_name="qiskit-aer", - additional_msg="approximation=True will be default in the future.", - ) def __init__( self, *, @@ -118,7 +112,7 @@ def __init__( warn( "Option approximation=False is deprecated as of qiskit-aer 0.13. " "It will be removed no earlier than 3 months after the release date. " - "Instead, use BackendEstmator from qiskit.primitives.", + "Instead, use BackendEstimator from qiskit.primitives.", DeprecationWarning, stacklevel=3, ) @@ -153,7 +147,7 @@ def approximation(self, approximation): warn( "Option approximation=False is deprecated as of qiskit-aer 0.13. " "It will be removed no earlier than 3 months after the release date. " - "Instead, use BackendEstmator from qiskit.primitives.", + "Instead, use BackendEstimator from qiskit.primitives.", DeprecationWarning, stacklevel=3, ) diff --git a/test/terra/primitives/test_estimator.py b/test/terra/primitives/test_estimator.py index deb73f7162..d7aa89f437 100644 --- a/test/terra/primitives/test_estimator.py +++ b/test/terra/primitives/test_estimator.py @@ -287,8 +287,7 @@ def test_with_shots_option_with_approximation(self, abelian_grouping): """test with shots option.""" # Note: abelian_gropuing is ignored when approximation is True as documented. # The purpose of this test is to make sure the results remain the same. - with self.assertWarns(DeprecationWarning): - est = Estimator(approximation=True, abelian_grouping=abelian_grouping) + est = Estimator(approximation=True, abelian_grouping=abelian_grouping) result = est.run( self.ansatz, self.observable, parameter_values=[[0, 1, 1, 2, 3, 5]], shots=1024, seed=15 ).result() @@ -332,8 +331,7 @@ def test_result_order(self): qc2.ry(np.pi / 2 * param, 0) qc2.measure_all() - with self.assertWarns(DeprecationWarning): - estimator = Estimator(approximation=True) + estimator = Estimator(approximation=True) job = estimator.run([qc1, qc2, qc1, qc1, qc2], ["Z"] * 5, [[], [1], [], [], [1]]) result = job.result() np.testing.assert_allclose(result.values, [1, 0, 1, 1, 0], atol=1e-10)