mirror of https://github.com/Qiskit/qiskit-aer.git
Fixes of tests for the latest Qiskit (#2026)
* fix test_aer_statevector * fix daily test * remove test case test.terra.states.test_aer_statevector.TestAerStatevector.test_number_to_latex_terms because of deprecation * add release note and remove temporal on push
This commit is contained in:
parent
ee519697b5
commit
08b07ce461
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Removed deprecate function test in
|
||||
test.terra.states.test_aer_statevector.TestAerStatevector.test_number_to_latex_terms
|
||||
|
||||
Sorted the output properties in
|
||||
test.terra.noise.test_device_models.test_basic_device_gate_errors_from_target_and_properties
|
||||
to compare correctly.
|
|
@ -59,7 +59,9 @@ class TestDeviceNoiseModel(QiskitAerTestCase):
|
|||
errors_from_properties = basic_device_gate_errors(properties=FakeNairobi().properties())
|
||||
errors_from_target = basic_device_gate_errors(target=FakeNairobiV2().target)
|
||||
self.assertEqual(len(errors_from_properties), len(errors_from_target))
|
||||
for err_properties, err_target in zip(errors_from_properties, errors_from_target):
|
||||
errors_from_properties_s = sorted(errors_from_properties)
|
||||
errors_from_target_s = sorted(errors_from_target)
|
||||
for err_properties, err_target in zip(errors_from_properties_s, errors_from_target_s):
|
||||
name1, qargs1, err1 = err_properties
|
||||
name2, qargs2, err2 = err_target
|
||||
self.assertEqual(name1, name2)
|
||||
|
|
|
@ -32,7 +32,7 @@ from qiskit.quantum_info import Kraus
|
|||
from qiskit.quantum_info.operators.operator import Operator
|
||||
from qiskit.quantum_info.operators.symplectic import Pauli, SparsePauliOp
|
||||
from qiskit.quantum_info.operators.predicates import matrix_equal
|
||||
from qiskit.visualization.state_visualization import numbers_to_latex_terms, state_to_latex
|
||||
from qiskit.visualization.state_visualization import state_to_latex
|
||||
from qiskit.circuit.library import QFT, HGate
|
||||
|
||||
from test.terra import common
|
||||
|
@ -1373,28 +1373,6 @@ class TestAerStatevector(common.QiskitAerTestCase):
|
|||
latex_representation = state_to_latex(sv)
|
||||
self.assertEqual(latex_representation, " |000000000000000\\rangle")
|
||||
|
||||
def test_number_to_latex_terms(self):
|
||||
"""Test conversions of complex numbers to latex terms"""
|
||||
|
||||
cases = [
|
||||
([1 - 8e-17, 0], ["", None]),
|
||||
([0, -1], [None, "-"]),
|
||||
([0, 1], [None, ""]),
|
||||
([0, 1j], [None, "i"]),
|
||||
([-1, 1], ["-", "+"]),
|
||||
([0, 1j], [None, "i"]),
|
||||
([-1, 1j], ["-", "+i"]),
|
||||
([1e-16 + 1j], ["i"]),
|
||||
([-1 + 1e-16 * 1j], ["-"]),
|
||||
([-1, -1 - 1j], ["-", "+(-1 - i)"]),
|
||||
([np.sqrt(2) / 2, np.sqrt(2) / 2], ["\\frac{\\sqrt{2}}{2}", "+\\frac{\\sqrt{2}}{2}"]),
|
||||
([1 + np.sqrt(2)], ["(1 + \\sqrt{2})"]),
|
||||
]
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
for numbers, latex_terms in cases:
|
||||
terms = numbers_to_latex_terms(numbers, 15)
|
||||
self.assertListEqual(terms, latex_terms)
|
||||
|
||||
def test_statevector_draw_latex_regression(self):
|
||||
"""Test numerical rounding errors are not printed"""
|
||||
sv = AerStatevector(np.array([1 - 8e-17, 8.32667268e-17j]))
|
||||
|
|
Loading…
Reference in New Issue