def test_initial_layout(self):
    "Using a non-trivial initial_layout.\n\n         q3:----------------m--\n         q0:----------m-----|--\n                      |     |\n         q1:-[H]-(+)--|-m---|--\n                  |   | |   |\n         q2:------.---|-|-m-|--\n                      | | | |\n         c0:----------.-|-|-|--\n         c1:------------.-|-|--\n         c2:--------------.-|--\n         c3:----------------.--\n         CouplingMap map: [1]<-[0]->[2]->[3]\n\n        expected count: '000': 50%\n                        '110': 50%\n        "
    self.counts = {'0000': 512, '0110': 512}
    self.shots = 1024
    self.delta = 5
    coupling_map = [[0, 1], [0, 2], [2, 3]]
    qr = QuantumRegister(4, 'q')
    cr = ClassicalRegister(4, 'c')
    circuit = QuantumCircuit(qr, cr, name='initial_layout')
    circuit.h(qr[1])
    circuit.cx(qr[1], qr[2])
    circuit.measure(qr, cr)
    layout = {qr[3]: 0, qr[0]: 1, qr[1]: 2, qr[2]: 3}
    result = self.create_passmanager(coupling_map, layout).run(circuit)
    self.assertResult(result, circuit)
Using a non-trivial initial_layout.

 q3:----------------m--
 q0:----------m-----|--
              |     |
 q1:-[H]-(+)--|-m---|--
          |   | |   |
 q2:------.---|-|-m-|--
              | | | |
 c0:----------.-|-|-|--
 c1:------------.-|-|--
 c2:--------------.-|--
 c3:----------------.--
 CouplingMap map: [1]<-[0]->[2]->[3]

expected count: '000': 50%
                '110': 50%
def test_initial_layout(self):
    "Using a non-trivial initial_layout.\n\n         q3:----------------m--\n         q0:----------m-----|--\n                      |     |\n         q1:-[H]-(+)--|-m---|--\n                  |   | |   |\n         q2:------.---|-|-m-|--\n                      | | | |\n         c0:----------.-|-|-|--\n         c1:------------.-|-|--\n         c2:--------------.-|--\n         c3:----------------.--\n         CouplingMap map: [1]<-[0]->[2]->[3]\n\n        expected count: '000': 50%\n                        '110': 50%\n        "
    self.counts = {'0000': 512, '0110': 512}
    self.shots = 1024
    self.delta = 5
    coupling_map = [[0, 1], [0, 2], [2, 3]]
    qr = QuantumRegister(4, 'q')
    cr = ClassicalRegister(4, 'c')
    circuit = QuantumCircuit(qr, cr, name='initial_layout')
    circuit.h(qr[1])
    circuit.cx(qr[1], qr[2])
    circuit.measure(qr, cr)
    layout = {qr[3]: 0, qr[0]: 1, qr[1]: 2, qr[2]: 3}
    result = self.create_passmanager(coupling_map, layout).run(circuit)
    self.assertResult(result, circuit)