Skip to content

Commit

Permalink
remove test case test.terra.states.test_aer_statevector.TestAerStatev…
Browse files Browse the repository at this point in the history
…ector.test_number_to_latex_terms because of deprecation
  • Loading branch information
doichanj committed Jan 11, 2024
1 parent bb91274 commit 0e8134c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
4 changes: 3 additions & 1 deletion test/terra/noise/test_device_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def test_basic_device_gate_errors_from_target_and_properties(self):
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)
Expand Down
24 changes: 1 addition & 23 deletions test/terra/states/test_aer_statevector.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
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
Expand Down Expand Up @@ -1373,28 +1373,6 @@ def test_state_to_latex_for_large_sparse_statevector(self):
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]))
Expand Down

0 comments on commit 0e8134c

Please sign in to comment.