diff --git a/test/terra/backends/aer_simulator/test_noise.py b/test/terra/backends/aer_simulator/test_noise.py index a4f223ae02..c851252e9f 100644 --- a/test/terra/backends/aer_simulator/test_noise.py +++ b/test/terra/backends/aer_simulator/test_noise.py @@ -243,12 +243,13 @@ def _test_kraus_gate_noise_on_QFT(self, **options): # manaully build noise circuit noise_circuit = QuantumCircuit(3) - for inst, qargs, cargs in ideal_circuit.data: - noise_circuit.append(inst, qargs, cargs) - if inst.name == "h": - noise_circuit.append(error1, qargs) - elif inst.name in ["cp", "swap"]: - noise_circuit.append(error2, qargs) + for inst in ideal_circuit.data: + noise_circuit.append(inst) + name = inst.operation.name + if name == "h": + noise_circuit.append(error1, inst.qubits) + elif name in ["cp", "swap"]: + noise_circuit.append(error2, inst.qubits) # compute target counts noise_state = DensityMatrix(noise_circuit) ref_target = {i: shots * p for i, p in noise_state.probabilities_dict().items()} diff --git a/test/terra/backends/aer_simulator/test_shot_branching.py b/test/terra/backends/aer_simulator/test_shot_branching.py index 5b330a4e53..63732b79b6 100644 --- a/test/terra/backends/aer_simulator/test_shot_branching.py +++ b/test/terra/backends/aer_simulator/test_shot_branching.py @@ -494,12 +494,13 @@ def test_shot_branching_kraus_gate_noise_on_QFT(self, method, device): # manaully build noise circuit noise_circuit = QuantumCircuit(3) - for inst, qargs, cargs in ideal_circuit.data: - noise_circuit.append(inst, qargs, cargs) - if inst.name == "h": - noise_circuit.append(error1, qargs) - elif inst.name in ["cp", "swap"]: - noise_circuit.append(error2, qargs) + for inst in ideal_circuit.data: + noise_circuit.append(inst) + name = inst.operation.name + if name == "h": + noise_circuit.append(error1, inst.qubits) + elif name in ["cp", "swap"]: + noise_circuit.append(error2, inst.qubits) # compute target counts noise_state = DensityMatrix(noise_circuit) ref_target = {i: shots * p for i, p in noise_state.probabilities_dict().items()}