def test_qobj_to_circuits_multiple(self):
     """Check that qobj_to_circuits's result with multiple circuits"""
     backend = Aer.get_backend('qasm_simulator_py')
     qreg1 = QuantumRegister(2)
     qreg2 = QuantumRegister(3)
     creg1 = ClassicalRegister(2)
     creg2 = ClassicalRegister(2)
     circuit_b = QuantumCircuit(qreg1, qreg2, creg1, creg2)
     circuit_b.x(qreg1)
     circuit_b.h(qreg2)
     circuit_b.measure(qreg1, creg1)
     circuit_b.measure(qreg2[0], creg2[1])
     qobj = compile([self.circuit, circuit_b], backend, skip_transpiler=True)
     dag_list = [DAGCircuit.fromQuantumCircuit(x) for x in qobj_to_circuits(qobj)]
     self.assertEqual(dag_list, [self.dag, DAGCircuit.fromQuantumCircuit(circuit_b)])
Ejemplo n.º 2
0
 def test_qobj_to_circuits_with_qobj_no_qasm(self):
     """Verify that qobj_to_circuits returns None without QASM."""
     qobj = Qobj('abc123', {}, {}, {})
     self.assertIsNone(qobj_to_circuits(qobj))
Ejemplo n.º 3
0
 def test_qobj_to_circuits_single(self):
     """Check that qobj_to_circuits's result matches the qobj ini."""
     backend = Aer.get_backend('qasm_simulator_py')
     qobj_in = compile(self.circuit, backend, skip_transpiler=True)
     out_circuit = qobj_to_circuits(qobj_in)
     self.assertEqual(out_circuit[0].qasm(), self.circuit.qasm())