Skip to content

Commit

Permalink
Add Aer check to sparse_pauli_op test
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT committed Dec 1, 2023
1 parent bee2a2d commit 96fe781
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from qiskit.primitives import BackendEstimator
from qiskit.providers.fake_provider import FakeGeneric
from qiskit.compiler.transpiler import transpile
from qiskit.utils import optionals


def pauli_mat(label):
Expand Down Expand Up @@ -1056,7 +1057,10 @@ def test_permute_sparse_pauli_op_estimator_example(self):
permuted_op = op.apply_layout(transpiled_psi.layout)
job = estimator.run(transpiled_psi, permuted_op, thetas)
res = job.result().values
np.testing.assert_allclose(res, [5.859375], rtol=0.5, atol=0.2)
if optionals.HAS_AER:
np.testing.assert_allclose(res, [5.859375], rtol=0.5, atol=0.2)
else:
np.testing.assert_allclose(res, [1.660156], rtol=0.5, atol=0.2)

def test_apply_layout_invalid_qubits_list(self):
"""Test that apply_layout with an invalid qubit count raises."""
Expand Down

0 comments on commit 96fe781

Please sign in to comment.