Skip to content

Commit

Permalink
update failing tests for changes in terra api (Qiskit#179)
Browse files Browse the repository at this point in the history
* Update failing tests for changes in Terra API
  • Loading branch information
chriseclectic authored and atilag committed Apr 26, 2019
1 parent c580a4c commit 6260442
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
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

0 comments on commit 6260442

Please sign in to comment.