Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 11, 2024
1 parent 551dbca commit 985a953
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,27 @@ def test_measurement_timings(dummy, compiler):
circ.add(gates.GPI2(q0, phi=0.0))
circ.add(gates.GPI2(q1, phi=np.pi / 2))
circ.add(gates.GPI2(q1, phi=np.pi))

# put measurement in different moments
circ.add(gates.M(q0))
circ.add(gates.M(q1))

# make sure they are in different moments before proceeding
assert not any([len([gate for gate in m if isinstance(gate, gates.M)]) == 2 for m in circ.queue.moments])

assert not any(
[
len([gate for gate in m if isinstance(gate, gates.M)]) == 2
for m in circ.queue.moments
]
)

circ._wire_names = [q0, q1]
sequence, _ = compiler.compile(circ, dummy)

MEASUREMENT_DURATION = 2000
for pulse in sequence.ro_pulses:
# assert that measurements don't happen one after another
assert not pulse.start >= MEASUREMENT_DURATION


def test_coupler_pulse_timing(dummy_couplers, compiler):
q0, q1, q2 = 0, 1, 2
Expand All @@ -51,9 +56,9 @@ def test_coupler_pulse_timing(dummy_couplers, compiler):
circ.add(gates.GPI2(q0, phi=np.pi))
circ.add(gates.GPI2(q1, phi=0.0))
circ.add(gates.CZ(q1, q2))

circ._wire_names = [q0, q1, q2]
sequence, _ = compiler.compile(circ, dummy_couplers)

coupler_pulse = sequence.cf_pulses[0]
assert coupler_pulse.start == 40

0 comments on commit 985a953

Please sign in to comment.