Skip to content

Commit

Permalink
Fix typos and add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxiLi committed Nov 9, 2021
1 parent a25ff9f commit b59f087
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
from qutip import process_fidelity, qeye, tracedist


def _varify_scheduled_circuit(circuit, gate_cycle_indices):
def _verify_scheduled_circuit(circuit, gate_cycle_indices):
"""
Compare results between the original and the scheduled circuit.
"""
result0 = gate_sequence_product(circuit.propagators())
scheduled_gate = [[] for i in range(max(gate_cycle_indices) + 1)]
for i, cycles in enumerate(gate_cycle_indices):
Expand Down Expand Up @@ -60,7 +63,7 @@ def test_commutation_rules(circuit, expected_length):
scheduler = Scheduler("ASAP")
gate_cycle_indices = scheduler.schedule(circuit)
assert (max(gate_cycle_indices) + 1) == expected_length
assert _varify_scheduled_circuit(circuit, gate_cycle_indices)
assert _verify_scheduled_circuit(circuit, gate_cycle_indices)


def _circuit1():
Expand Down Expand Up @@ -142,7 +145,7 @@ def test_scheduling_gates1(
)

assert max(gate_cycle_indices) == expected_length
_varify_scheduled_circuit(circuit, gate_cycle_indices)
_verify_scheduled_circuit(circuit, gate_cycle_indices)


# There is some problem with circuit2 on Mac.
Expand Down Expand Up @@ -172,7 +175,7 @@ def test_scheduling_gates2(
)

assert max(gate_cycle_indices) == expected_length
_varify_scheduled_circuit(circuit, gate_cycle_indices)
_verify_scheduled_circuit(circuit, gate_cycle_indices)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -204,7 +207,7 @@ def test_scheduling_gates3(
)

assert max(gate_cycle_indices) == expected_length
_varify_scheduled_circuit(circuit, gate_cycle_indices)
_verify_scheduled_circuit(circuit, gate_cycle_indices)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -236,7 +239,7 @@ def test_scheduling_gates4(
)

assert max(gate_cycle_indices) == expected_length
_varify_scheduled_circuit(circuit, gate_cycle_indices)
_verify_scheduled_circuit(circuit, gate_cycle_indices)


@pytest.mark.parametrize(
Expand Down

0 comments on commit b59f087

Please sign in to comment.