Skip to content

Commit

Permalink
Skip other tests requiring tweedledum
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Oct 11, 2022
1 parent a27dc07 commit 857b8a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/python/algorithms/test_grover.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from qiskit.circuit.library import GroverOperator, PhaseOracle
from qiskit.primitives import Sampler
from qiskit.quantum_info import Operator, Statevector
from qiskit.utils.optionals import HAS_TWEEDLEDUM


@ddt
Expand Down Expand Up @@ -100,6 +101,7 @@ def setUp(self):
self._sampler = Sampler()
self._sampler_with_shots = Sampler(options={"shots": 1024, "seed": 123})

@unittest.skipUnless(HAS_TWEEDLEDUM, "tweedledum required for this test")
@data("ideal", "shots", False)
def test_implicit_phase_oracle_is_good_state(self, use_sampler):
"""Test implicit default for is_good_state with PhaseOracle."""
Expand Down Expand Up @@ -278,6 +280,7 @@ def test_max_probability(self, use_sampler):
result = grover.amplify(problem)
self.assertAlmostEqual(result.max_probability, 1.0)

@unittest.skipUnless(HAS_TWEEDLEDUM, "tweedledum required for this test")
@data("ideal", "shots", False)
def test_oracle_evaluation(self, use_sampler):
"""Test oracle_evaluation for PhaseOracle"""
Expand Down
2 changes: 2 additions & 0 deletions test/python/circuit/library/test_phase_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
from qiskit.test.base import QiskitTestCase
from qiskit.circuit.library import PhaseOracle
from qiskit.quantum_info import Statevector
from qiskit.utils.optionals import HAS_TWEEDLEDUM


@unittest.skipUnless(HAS_TWEEDLEDUM, "Tweedledum is required for these tests")
@ddt
class TestPhaseOracle(QiskitTestCase):
"""Test phase oracle object."""
Expand Down
3 changes: 3 additions & 0 deletions test/python/circuit/test_extensions_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from qiskit import BasicAer
from qiskit.quantum_info import Pauli
from qiskit.quantum_info.operators.predicates import matrix_equal, is_unitary_matrix
from qiskit.utils.optionals import HAS_TWEEDLEDUM


class TestStandard1Q(QiskitTestCase):
Expand Down Expand Up @@ -1399,6 +1400,7 @@ def test_cswap_reg_reg_inv(self):
class TestStandardMethods(QiskitTestCase):
"""Standard Extension Test."""

@unittest.skipUnless(HAS_TWEEDLEDUM, "tweedledum required for this test")
def test_to_matrix(self):
"""test gates implementing to_matrix generate matrix which matches definition."""
from qiskit.circuit.library.pauli_evolution import PauliEvolutionGate
Expand Down Expand Up @@ -1444,6 +1446,7 @@ def test_to_matrix(self):
self.assertTrue(matrix_equal(definition_unitary, gate_matrix, ignore_phase=True))
self.assertTrue(is_unitary_matrix(gate_matrix))

@unittest.skipUnless(HAS_TWEEDLEDUM, "tweedledum required for this test")
def test_to_matrix_op(self):
"""test gates implementing to_matrix generate matrix which matches
definition using Operator."""
Expand Down

0 comments on commit 857b8a6

Please sign in to comment.