def test_asap_pass(self):
    'Test ASAP scheduling.'
    q = QuantumRegister(2)
    c = ClassicalRegister(2)
    qc = QuantumCircuit(q, c)
    qc.u2(3.14, 1.57, q[0])
    qc.u2(0.5, 0.25, q[1])
    qc.barrier(q[1])
    qc.u2(0.5, 0.25, q[1])
    qc.barrier(q[0], q[1])
    qc.cx(q[0], q[1])
    qc.measure(q, c)
    sched = schedule(qc, self.backend, method='as_soon_as_possible')
    expected = Schedule(self.cmd_def.get('u2', [0], 3.14, 1.57), self.cmd_def.get('u2', [1], 0.5, 0.25), (28, self.cmd_def.get('u2', [1], 0.5, 0.25)), (56, self.cmd_def.get('cx', [0, 1])), (78, self.cmd_def.get('measure', [0, 1])))
    self.assertEqual(sched.instructions, expected.instructions)
Test ASAP scheduling.
def test_asap_pass(self):
    
    q = QuantumRegister(2)
    c = ClassicalRegister(2)
    qc = QuantumCircuit(q, c)
    qc.u2(3.14, 1.57, q[0])
    qc.u2(0.5, 0.25, q[1])
    qc.barrier(q[1])
    qc.u2(0.5, 0.25, q[1])
    qc.barrier(q[0], q[1])
    qc.cx(q[0], q[1])
    qc.measure(q, c)
    sched = schedule(qc, self.backend, method='as_soon_as_possible')
    expected = Schedule(self.cmd_def.get('u2', [0], 3.14, 1.57), self.cmd_def.get('u2', [1], 0.5, 0.25), (28, self.cmd_def.get('u2', [1], 0.5, 0.25)), (56, self.cmd_def.get('cx', [0, 1])), (78, self.cmd_def.get('measure', [0, 1])))
    self.assertEqual(sched.instructions, expected.instructions)