https://github.com/Qiskit/qiskit-aer/commit/cec5c11513118fa8d701e2bef1376dc3db7263c3 From cec5c11513118fa8d701e2bef1376dc3db7263c3 Mon Sep 17 00:00:00 2001 From: Jun Doi Date: Fri, 27 Jan 2023 18:55:59 +0900 Subject: [PATCH] Fix test_aer_statevector (#1710) * fix test_aer_statevector * add plot directive to docs * fix test_aer_statevector and remove reno Co-authored-by: Hiroshi Horii --- a/docs/conf.py +++ b/docs/conf.py @@ -67,6 +67,7 @@ extensions = [ 'sphinx_tabs.tabs', 'jupyter_sphinx', 'reno.sphinxext', + 'matplotlib.sphinxext.plot_directive', ] html_static_path = ['_static'] templates_path = ['_templates'] --- a/test/terra/states/test_aer_statevector.py +++ b/test/terra/states/test_aer_statevector.py @@ -1347,13 +1347,14 @@ class TestAerStatevector(common.QiskitAerTestCase): ([-1, 1j], ["-", "+i"]), ([1e-16 + 1j], ["i"]), ([-1 + 1e-16 * 1j], ["-"]), - ([-1, -1 - 1j], ["-", "+ (-1 - i)"]), + ([-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})"]), ] - for numbers, latex_terms in cases: - terms = numbers_to_latex_terms(numbers) - self.assertListEqual(terms, latex_terms) + 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"""