-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add / update tests for predicates in stabiliser sim
Added a new unit test that checks we include the CliffordCircuitPredicate only when we're running with a stabilizer simulator type (and not when we have a statevector simulator). Also update test_simulator to expect to fail on compilation, rather than breaking on get_result().
- Loading branch information
1 parent
50a165f
commit 333fa91
Showing
2 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import pytest | ||
from pytket.predicates import CliffordCircuitPredicate | ||
|
||
from pytket.extensions.quantinuum import QuantinuumAPIOffline, QuantinuumBackend | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"simulator_type,should_have_clifford_predicate", | ||
[ | ||
("state-vector", False), | ||
("stabilizer", True), | ||
], | ||
) | ||
def test_clifford_circuits_for_stabilizer( | ||
simulator_type: str, | ||
should_have_clifford_predicate: bool, | ||
) -> None: | ||
qapi_offline = QuantinuumAPIOffline() | ||
backend = QuantinuumBackend( | ||
api_handler=qapi_offline, | ||
simulator=simulator_type, | ||
) | ||
required_predicates = backend.required_predicates | ||
assert should_have_clifford_predicate == any( | ||
(isinstance(pred, CliffordCircuitPredicate) for pred in required_predicates) | ||
) |