Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️πŸͺ update pre-commit hooks #396

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ repos:

# Python linting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
rev: v0.1.5
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -68,7 +68,7 @@ repos:

# Check static types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.7.0
hooks:
- id: mypy
files: ^(src/mqt|test/python)
Expand Down Expand Up @@ -104,7 +104,7 @@ repos:

# Format configuration files with prettier
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.1.0
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
Expand Down
16 changes: 8 additions & 8 deletions test/python/test_cliffordsynthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,55 +230,55 @@ def bell_circuit() -> QuantumCircuit:
def test_optimize_quantum_computation(bell_circuit: QuantumCircuit) -> None:
"""Test that we can optimize an MQT QuantumComputation."""
qc = qmap.QuantumComputation.from_qiskit(bell_circuit)
circ, results = qmap.optimize_clifford(circuit=qc)
circ, _ = qmap.optimize_clifford(circuit=qc)
assert qcec.verify(circ, bell_circuit).considered_equivalent()


def test_optimize_from_qasm_file(bell_circuit: QuantumCircuit) -> None:
"""Test that we can optimize from a QASM file."""
with Path("bell.qasm").open("w") as f:
f.write(bell_circuit.qasm())
circ, results = qmap.optimize_clifford(circuit="bell.qasm")
circ, _ = qmap.optimize_clifford(circuit="bell.qasm")
assert qcec.verify(circ, bell_circuit).considered_equivalent()


def test_optimize_qiskit_circuit(bell_circuit: QuantumCircuit) -> None:
"""Test that we can optimize a Qiskit QuantumCircuit."""
circ, results = qmap.optimize_clifford(circuit=bell_circuit)
circ, _ = qmap.optimize_clifford(circuit=bell_circuit)
assert qcec.verify(circ, bell_circuit).considered_equivalent()


def test_optimize_with_initial_tableau(bell_circuit: QuantumCircuit) -> None:
"""Test that we can optimize a circuit with an initial tableau."""
circ, results = qmap.optimize_clifford(circuit=bell_circuit, initial_tableau=qmap.Tableau(bell_circuit.num_qubits))
circ, _ = qmap.optimize_clifford(circuit=bell_circuit, initial_tableau=qmap.Tableau(bell_circuit.num_qubits))
assert qcec.verify(circ, bell_circuit).considered_equivalent()


def test_synthesize_from_tableau(bell_circuit: QuantumCircuit) -> None:
"""Test that we can synthesize a circuit from an MQT Tableau."""
tableau = qmap.Tableau("['XX', 'ZZ']")
circ, results = qmap.synthesize_clifford(target_tableau=tableau)
circ, _ = qmap.synthesize_clifford(target_tableau=tableau)
assert qcec.verify(circ, bell_circuit).considered_equivalent()


def test_synthesize_from_qiskit_clifford(bell_circuit: QuantumCircuit) -> None:
"""Test that we can synthesize a circuit from a Qiskit Clifford."""
cliff = Clifford(bell_circuit)
circ, results = qmap.synthesize_clifford(target_tableau=cliff)
circ, _ = qmap.synthesize_clifford(target_tableau=cliff)
assert qcec.verify(circ, bell_circuit).considered_equivalent()


def test_synthesize_from_qiskit_pauli_list(bell_circuit: QuantumCircuit) -> None:
"""Test that we can synthesize a circuit from a Qiskit PauliList."""
pauli_list = PauliList(["XX", "ZZ"])
circ, results = qmap.synthesize_clifford(target_tableau=pauli_list)
circ, _ = qmap.synthesize_clifford(target_tableau=pauli_list)
assert qcec.verify(circ, bell_circuit).considered_equivalent()


def test_synthesize_from_string(bell_circuit: QuantumCircuit) -> None:
"""Test that we can synthesize a circuit from a String."""
pauli_str = "[XX,ZZ]"
circ, results = qmap.synthesize_clifford(target_tableau=pauli_str)
circ, _ = qmap.synthesize_clifford(target_tableau=pauli_str)
assert qcec.verify(circ, bell_circuit).considered_equivalent()


Expand Down