def test_3q_schedule(self):
    'Test a schedule that was recommended by David McKay :D '
    backend = FakeOpenPulse3Q()
    cmd_def = backend.defaults().build_cmd_def()
    q = QuantumRegister(3)
    c = ClassicalRegister(3)
    qc = QuantumCircuit(q, c)
    qc.cx(q[0], q[1])
    qc.u2(0.778, 0.122, q[2])
    qc.u3(3.14, 1.57, 0.0, q[0])
    qc.u2(3.14, 1.57, q[1])
    qc.cx(q[1], q[2])
    qc.u2(0.778, 0.122, q[2])
    sched = schedule(qc, backend)
    expected = Schedule(cmd_def.get('cx', [0, 1]), (22, cmd_def.get('u2', [1], 3.14, 1.57)), (46, cmd_def.get('u2', [2], 0.778, 0.122)), (50, cmd_def.get('cx', [1, 2])), (72, cmd_def.get('u2', [2], 0.778, 0.122)), (74, cmd_def.get('u3', [0], 3.14, 1.57)))
    self.assertEqual(sched.instructions, expected.instructions)
Test a schedule that was recommended by David McKay :D
def test_3q_schedule(self):
    ' '
    backend = FakeOpenPulse3Q()
    cmd_def = backend.defaults().build_cmd_def()
    q = QuantumRegister(3)
    c = ClassicalRegister(3)
    qc = QuantumCircuit(q, c)
    qc.cx(q[0], q[1])
    qc.u2(0.778, 0.122, q[2])
    qc.u3(3.14, 1.57, 0.0, q[0])
    qc.u2(3.14, 1.57, q[1])
    qc.cx(q[1], q[2])
    qc.u2(0.778, 0.122, q[2])
    sched = schedule(qc, backend)
    expected = Schedule(cmd_def.get('cx', [0, 1]), (22, cmd_def.get('u2', [1], 3.14, 1.57)), (46, cmd_def.get('u2', [2], 0.778, 0.122)), (50, cmd_def.get('cx', [1, 2])), (72, cmd_def.get('u2', [2], 0.778, 0.122)), (74, cmd_def.get('u3', [0], 3.14, 1.57)))
    self.assertEqual(sched.instructions, expected.instructions)