def test_alap_aligns_end(self):
    'Test that ALAP always acts as though there is a final global barrier.'
    q = QuantumRegister(2)
    c = ClassicalRegister(2)
    qc = QuantumCircuit(q, c)
    qc.u3(0, 0, 0, q[0])
    qc.u2(0, 0, q[1])
    sched = schedule(qc, self.backend, method='alap')
    expected_sched = Schedule(self.cmd_def.get('u2', [1], 0, 0), (26, self.cmd_def.get('u3', [0], 0, 0, 0)))
    for (actual, expected) in zip(sched.instructions, expected_sched.instructions):
        self.assertEqual(actual[0], expected[0])
        self.assertEqual(actual[1].command, expected[1].command)
        self.assertEqual(actual[1].channels, expected[1].channels)
    self.assertEqual(sched.ch_duration(DriveChannel(0)), expected_sched.ch_duration(DriveChannel(1)))
Test that ALAP always acts as though there is a final global barrier.
def test_alap_aligns_end(self):
    
    q = QuantumRegister(2)
    c = ClassicalRegister(2)
    qc = QuantumCircuit(q, c)
    qc.u3(0, 0, 0, q[0])
    qc.u2(0, 0, q[1])
    sched = schedule(qc, self.backend, method='alap')
    expected_sched = Schedule(self.cmd_def.get('u2', [1], 0, 0), (26, self.cmd_def.get('u3', [0], 0, 0, 0)))
    for (actual, expected) in zip(sched.instructions, expected_sched.instructions):
        self.assertEqual(actual[0], expected[0])
        self.assertEqual(actual[1].command, expected[1].command)
        self.assertEqual(actual[1].channels, expected[1].channels)
    self.assertEqual(sched.ch_duration(DriveChannel(0)), expected_sched.ch_duration(DriveChannel(1)))