Skip to content

Commit

Permalink
removing more unnecesary catches
Browse files Browse the repository at this point in the history
  • Loading branch information
1ucian0 committed Jul 25, 2024
1 parent 4e83c99 commit b69bdf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
11 changes: 3 additions & 8 deletions test/python/transpiler/test_sabre_swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import unittest

import itertools
import warnings

import ddt
import numpy.random
Expand Down Expand Up @@ -280,13 +279,9 @@ def test_no_infinite_loop(self, method):

from qiskit_aer import Aer

with warnings.catch_warnings():
# TODO remove this catch once Aer stops using QobjDictField and Provider ABC
# https://github.com/Qiskit/qiskit-aer/pull/2184
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
sim = Aer.get_backend("aer_simulator")
in_results = sim.run(qc, shots=4096).result().get_counts()
out_results = sim.run(routed, shots=4096).result().get_counts()
sim = Aer.get_backend("aer_simulator")
in_results = sim.run(qc, shots=4096).result().get_counts()
out_results = sim.run(routed, shots=4096).result().get_counts()
self.assertEqual(set(in_results), set(out_results))

def test_classical_condition(self):
Expand Down
15 changes: 4 additions & 11 deletions test/python/transpiler/test_star_prerouting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Test the StarPreRouting pass"""

import unittest
import warnings

from test import QiskitTestCase
import ddt
Expand Down Expand Up @@ -260,11 +259,8 @@ def test_100q_grid_full_path(self, opt_level):
)
pm.init += StarPreRouting()
result = pm.run(qc)
with warnings.catch_warnings():
# TODO remove this catch once Aer stops using qiskit.qobj.common.QobjDictField`
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
counts_before = AerSimulator().run(qc).result().get_counts()
counts_after = AerSimulator().run(result).result().get_counts()
counts_before = AerSimulator().run(qc).result().get_counts()
counts_after = AerSimulator().run(result).result().get_counts()
self.assertEqual(counts_before, counts_after)

def test_10q_bv_no_barrier(self):
Expand Down Expand Up @@ -303,11 +299,8 @@ def test_100q_grid_full_path_no_barrier(self, opt_level):
)
pm.init += StarPreRouting()
result = pm.run(qc)
with warnings.catch_warnings():
# TODO remove this catch once Aer stops using qiskit.qobj.common.QobjDictField`
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
counts_before = AerSimulator().run(qc).result().get_counts()
counts_after = AerSimulator().run(result).result().get_counts()
counts_before = AerSimulator().run(qc).result().get_counts()
counts_after = AerSimulator().run(result).result().get_counts()
self.assertEqual(counts_before, counts_after)

def test_hadamard_ordering(self):
Expand Down

0 comments on commit b69bdf9

Please sign in to comment.