Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update failing tests for changes in terra api #179

Merged
merged 2 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qiskit/providers/aer/noise/errors/errorutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def circuit2superop(circuit, min_qubits=1):
qubits = instr.qubits
else:
qubits = instr['qubits']
superop = superop.compose(instr_op, qubits=qubits)
superop = superop.compose(instr_op, qubits)
return superop


Expand Down
7 changes: 3 additions & 4 deletions test/terra/backends/qasm_simulator/qasm_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"""
from test.terra.utils.mock import FakeFailureQasmSimulator, FakeSuccessQasmSimulator
from qiskit.transpiler import transpile
from qiskit.compiler import assemble_circuits
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit import assemble, QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.providers.aer import AerError


Expand All @@ -24,7 +23,7 @@ def test_simulation_succeed(self):
cr = ClassicalRegister(1)
succeed_circuit = QuantumCircuit(qr, cr)
quantum_circuit = transpile(succeed_circuit, mocked_backend)
qobj = assemble_circuits(quantum_circuit)
qobj = assemble(quantum_circuit)
result = mocked_backend.run(qobj).result()
self.is_completed(result)

Expand All @@ -36,6 +35,6 @@ def test_simulation_failed(self):
cr = ClassicalRegister(1)
failed_circuit = QuantumCircuit(qr, cr)
quantum_circuit = transpile(failed_circuit, mocked_backend)
qobj = assemble_circuits(quantum_circuit)
qobj = assemble(quantum_circuit)
job = mocked_backend.run(qobj)
self.assertRaises(AerError, job.result)
7 changes: 3 additions & 4 deletions test/terra/backends/test_statevector_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
from test.terra.reference import ref_non_clifford
from test.terra.reference import ref_unitary_gate

from qiskit import execute
from qiskit.compiler import assemble_circuits, RunConfig
from qiskit import execute, assemble
from qiskit.providers.aer import StatevectorSimulator


Expand All @@ -35,7 +34,7 @@ def test_initialize_1(self):
"""Test StatevectorSimulator initialize"""
circuits = ref_initialize.initialize_circuits_1(final_measure=False)
targets = ref_initialize.initialize_statevector_1()
qobj = assemble_circuits(circuits, run_config=RunConfig(shots=1))
qobj = assemble(circuits, shots=1)
sim_job = StatevectorSimulator().run(qobj)
result = sim_job.result()
self.is_completed(result)
Expand All @@ -45,7 +44,7 @@ def test_initialize_2(self):
"""Test StatevectorSimulator initialize"""
circuits = ref_initialize.initialize_circuits_2(final_measure=False)
targets = ref_initialize.initialize_statevector_2()
qobj = assemble_circuits(circuits, run_config=RunConfig(shots=1))
qobj = assemble(circuits, shots=1)
sim_job = StatevectorSimulator().run(qobj)
result = sim_job.result()
self.is_completed(result)
Expand Down
8 changes: 5 additions & 3 deletions test/terra/utils/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
The mock devices are mainly for testing the compiler.
"""

import datetime
import uuid
import logging
from concurrent import futures
Expand Down Expand Up @@ -79,15 +80,16 @@ def __init__(self, configuration, time_alive=10):

def properties(self):
"""Return backend properties"""
dummy_date = datetime.datetime.now().isoformat()
properties = {
'backend_name': self.name(),
'backend_version': self.configuration().backend_version,
'last_update_date': '2000-01-01 00:00:00Z',
'qubits': [[{'name': 'TODO', 'date': '2000-01-01 00:00:00Z',
'last_update_date': dummy_date,
'qubits': [[{'name': 'TODO', 'date': dummy_date,
'unit': 'TODO', 'value': 0}]],
'gates': [{'qubits': [0], 'gate': 'TODO',
'parameters':
[{'name': 'TODO', 'date': '2000-01-01 00:00:00Z',
[{'name': 'TODO', 'date': dummy_date,
'unit': 'TODO', 'value': 0}]}],
'general': []
}
Expand Down