diff --git a/test/aqua/operators/test_aer_pauli_expectation.py b/test/aqua/operators/test_aer_pauli_expectation.py index e50b422f6b..8befc1cd72 100644 --- a/test/aqua/operators/test_aer_pauli_expectation.py +++ b/test/aqua/operators/test_aer_pauli_expectation.py @@ -1,6 +1,6 @@ # This code is part of Qiskit. # -# (C) Copyright IBM 2018, 2020. +# (C) Copyright IBM 2018, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -165,7 +165,10 @@ def generate_parameters(num): def validate_sampler(ideal, sut, param_bindings): expect_sampled = ideal.convert(expect_op, params=param_bindings).eval() actual_sampled = sut.convert(expect_op, params=param_bindings).eval() - self.assertAlmostEqual(actual_sampled, expect_sampled, delta=.1) + self.assertTrue( + np.allclose(actual_sampled, expect_sampled), + "%s != %s" % (actual_sampled, expect_sampled), + ) def get_circuit_templates(sampler): return sampler._transpiled_circ_templates diff --git a/test/aqua/operators/test_gradients.py b/test/aqua/operators/test_gradients.py index a4d54824db..100eca472f 100644 --- a/test/aqua/operators/test_gradients.py +++ b/test/aqua/operators/test_gradients.py @@ -1,6 +1,6 @@ # This code is part of Qiskit. # -# (C) Copyright IBM 2019, 2020. +# (C) Copyright IBM 2019, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -19,7 +19,6 @@ import numpy as np from ddt import ddt, data, idata, unpack -from sympy import Symbol, cos try: import jax.numpy as jnp @@ -279,10 +278,7 @@ def test_state_gradient3(self, method): a = Parameter('a') # b = Parameter('b') params = a - x = Symbol('x') - expr = cos(x) + 1 - c = ParameterExpression({a: x}, expr) - + c = np.cos(a) + 1 q = QuantumRegister(1) qc = QuantumCircuit(q) qc.h(q)